Jump to content
ckrudelux

Um.. What? Ubuntu

Recommended Posts

I have executed in my terminal with success generating a class file.javac HelloWorldApp.java But then I type to execute the program I get some errors:java HelloWorldApp

Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorldApp : Unsupported major.minor version 51.0at java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClass(ClassLoader.java:634)at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)at java.net.URLClassLoader.access$000(URLClassLoader.java:73)at java.net.URLClassLoader$1.run(URLClassLoader.java:212)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:205)at java.lang.ClassLoader.loadClass(ClassLoader.java:321)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)at java.lang.ClassLoader.loadClass(ClassLoader.java:266)Could not find the main class: HelloWorldApp. Program will exit.

What... is where a setup I missed? This should be a simple "hello world" output xD HelloWorldApp.java

/*** The HelloWorldApp class implements an application that* simply prints "Hello World!" to standard output.*/class HelloWorldApp {	public static void main(String[] args) {		System.out.println("Hello World!"); // Display the string.	}}

Edit:I have tried with adding the option -cp aka -classpath with no luck.java -cp . HelloWorldApp Have tried several paths none of them have worked out for me...///home/ckrudelux/Documents/Java/ Edit: Have checked version of my Java and I get 1.7 from javac and 1.6 from java, I have read that mixed versions can be a problem but I only installed the JDK 7 so I don't know why I got JDK 6 as well in my etc folder, checked with an other computer which I haven't installed JDK and can't find any JDK installed so the JDK 6 must had come from the JDK 7 installation. Edit: I have now tested to compile a broken code by removing the ";" at the end and got as suspected an error by the compiler, added the ";" again and complied it, also tested to execute the program and it worked. I have no clue on what was wrong but I guess encoding but would that pass the compiler in what case?

Edited by ckrudelux

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...