Are you sure that your CLASSPATH is set correctly when you are trying to
execute the version compiled with the java compiler.
As long as your source does not use any of the .NET extensions (conditional
compile for ex), you should be able to recompile it with JavaC.exe and the
result should run.Your sample seems to indicate that you are ok.
You don't even have to rename the java source in between. You can rename
them inside Visual J# because VJ# accepts both .jsl and .java for Java
source files (otherwise it would not be compatible with VJ++).
Bruno.
"Horus Alkebulan" <replytogroup@nospam.com> a écrit dans le message de
news:umKJjnMxDHA.2304@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view] > I'm a first year computer science student, but a long time Visual Studio
> .NET user. I would love to be able to write my Java code with VS.NET
> 2003 but my projects must be submitted as SDK1.4 .java files.
>
> What's the easiest way to convert my .jsl files to standard .java files
> so I can compile with JavaC.exe and run with Java.exe?
>
> I tried writing a simple console app in VS.NET using J Sharp and just
> changing the extensions to .java but I get errors when running "JAVA
> ClassName." It seems to compile okay as all the .class files are
generated.
>
> TIA!
>
> Horus
>
> Error and code is below...
>
> ====== ERROR =========
>
> C:\Documents and Settings\xxxxx\My Documents\Visual Studio
> Projects\poly>java Class1
>
> Exception in thread "main" java.lang.NoClassDefFoundError: Class1 (wrong
> name: poly/Class1)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at java.security.SecureClassLoader.defineClass(Unknown Source)
> at java.net.URLClassLoader.defineClass(Unknown Source)
> at java.net.URLClassLoader.access$100(Unknown Source)
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> ====== CODE =========
>
> package poly;
>
> public class Class1
> {
> public Class1()
> {
> }
>
> /** @attribute System.STAThread() */
> public static void main(String[] args)
> {
>
> System.out.println("Ready.");
>
> System.out.println("Variable:Class, Object:Class");
> poly.ModelXP100 xp1 = new ModelXP100();
> xp1.processorSpeed();
> xp1.floppyDrive();
>
> System.out.println("Variable:Interface, Object:Class");
> poly.Computer xp1i = new ModelXP100();
> xp1i.processorSpeed();
> }
> }
>