× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Drop the .class extension. Try:

java Test18jn2012

Worked for me in QSH.

Pete Helgren
Value Added Software, Inc
www.petesworkshop.com
GIAC Secure Software Programmer-Java


On 6/18/2012 12:51 PM, James Lampert wrote:
I have a simple Java 6 test program, just one class:

import java.nio.charset.*;
public class Test18jn2012 {
public static void main(String[] args) {
String str = "I like Spam.";
byte[] bytes;
bytes = str.getBytes(Charset.defaultCharset());
for (int i=0; i< bytes.length; i++) System.out.print(bytes[i] + "
"); System.out.println();
}
}

It executes just fine in Eclipse. It executes just fine on a WinDoze
command line, even if I move it to a different directory from where I'd
compiled it into.

But when I FTP Test18jn2012.class to the IFS root on our 400, and I try
java Test18jn2012
from either a regular command line or a QShell command line, I get:
Exception in thread "main" java.lang.UnsupportedClassVersionError: (Test18jn2012) bad major version at offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:267)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:600)
at java.net.URLClassLoader.access$400(URLClassLoader.java:124)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1055)
at java.security.AccessController.doPrivileged(AccessController.java:274)
at java.net.URLClassLoader.findClass(URLClassLoader.java:492)
at java.lang.ClassLoader.loadClass(ClassLoader.java:640)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:606)
Java program completed with exit code 1
and if I try
JAVA CLASS(Test18jn2012) CLASSPATH('/qibm/ProdData/Java400/jdk6')
I get
Exception in thread "main" java.lang.NoClassDefFoundError: Test18jn2012
Caused by: java.lang.ClassNotFoundException: Test18jn2012
at java.net.URLClassLoader.findClass(URLClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:640)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:606)
Java program completed with exit code 1
I'm obviously doing something wrong, but WHAT?

--
JHHL

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.