Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Running Java with Windows Powershell 2.0

807580Jun 30 2009 — edited Jul 23 2010
I am having trouble running a Java programe with Windows Powershell. Any help on this would be greatly appreciated.

My test class is:
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}
My PowerShell 2.0 code is this:
set-item -path Env:CLASSPATH -value C:\Test
"CLASSPATH = $Env:CLASSPATH"
java -classpath $Env:CLASSPATH C:\Test\HelloWorldApp
And the error I get is this:
PS >C:\Test\Test.ps1
CLASSPATH = C:\Test
java.exe : java.lang.NoClassDefFoundError: C:\Test\HelloWorldApp
At C:\Test\Site.ps1:3 char:5
+ java <<<<  -classpath $Env:CLASSPATH C:\Test\HelloWorldApp
+ CategoryInfo : NotSpecified: (java.lang.NoCla...e\HelloWorldApp:
                               String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError 
Exception in thread "main" 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2010
Added on Jun 30 2009
14 comments
5,485 views