Running examples in Cloudsim - error

2,142 views
Skip to first unread message

Srishti

unread,
Apr 2, 2013, 12:09:19 PM4/2/13
to clou...@googlegroups.com
Hello,

I am a new cloudsim user and just started my preliminary studies in clouds. I installed and compiled cloudsim perfectly on my system (linux and mac). Now I am trying to compile and run the already given examples in the package. However, when I compile the examples (any of them) I get the following warning:

warning: org/cloudbus/cloudsim/Cloudlet.class(org/cloudbus/cloudsim:Cloudlet.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
 which is repeated for other classes within that example file.

However, these are all warnings and not errors. So I went ahead and tried to run the java example, which then gave me the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/cloudbus/cloudsim/CloudletScheduler : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: org.cloudbus.cloudsim.examples.CloudSimExample1.  Program will exit.


Could anyone please suggest a solution to this problem. Do I need to upgrade my java compiler or is there another way around this problem.

Thank you.

Srishti

Raj Mit

unread,
Apr 3, 2013, 12:01:01 AM4/3/13
to clou...@googlegroups.com




Srishti

--
 
---
You received this message because you are subscribed to the Google Groups "cloudsim" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudsim+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Alessandro Leite

unread,
Apr 3, 2013, 3:03:29 AM4/3/13
to clou...@googlegroups.com
This error java.lang.UnsupportedClassVersionError occurs because you are using a higher JDK version to compile the code and a lower JRE version to execute it. This is the meaning of the message "Unsupported major.minor version 51.0"; this number 51 means that the minor supported version is the JRE 7;

So the solution is to either: upgrade your JRE or recompile the class with the option -source 1.5 or 1.6. 




Srishti

--

Srishti

unread,
Apr 3, 2013, 11:10:17 AM4/3/13
to clou...@googlegroups.com
thanks I upgraded to java 7 and it works now on my suse linux machine!

Is it ok to run cloudsim on a mac (Mac OS X Lion 10.7.5) machine?

Alessandro Leite

unread,
Apr 3, 2013, 12:16:15 PM4/3/13
to clou...@googlegroups.com
Yes. Because it's Java and the OS X is BSD based.

Seyed Majid Razavian

unread,
May 6, 2013, 3:26:17 AM5/6/13
to clou...@googlegroups.com
Ok I have this problem i changed default jdk from /etc/netbeans.cong and the problem is fixed
Reply all
Reply to author
Forward
0 new messages