Home:ALL Converter>gij (GNU libgcj) version

gij (GNU libgcj) version

Ask Time:2014-10-07T16:03:24         Author:user2090961

Json Formatter

Good day to everybody! I wrote simple program :

import java.lang.System;

public class hello{
  public static void main(String[] args){
     System.out.println("Hello World");
  }
}

This is working fine if run it on local server. But i'm facing issue when i access this program remotely like this:

ssh remote_machine "java hello"

I'm getting below error:

  Exception in thread "main" java.lang.NoClassDefFoundError: hello
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException: hello not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./],    parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)

I found that it's becasue of incosistency of jvm version and code compiled java version. Incosistency is happening because when i created and complied the code that machine is using java 1.5 , but when i remotely accessing it, it's using java 1.4 via "gij (GNU libgcj) version 4.1.2 20080704"

Question : is it possible to by pass "gij (GNU libgcj) version 4.1.2 20080704" and use initially used java version when i access it remotely?

Author:user2090961,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26231314/gij-gnu-libgcj-version
yy