NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Passing variables via command line

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
mplar
Posted via mailing list.





PostPosted: Thu Aug 13, 2009 2:41 pm    Post subject: Passing variables via command line Reply with quote

Dear all,

I am new to Netbeans and as way of a tutorial, I am trying pass variables
from the command line to a simple programme that I have constructed using
Netbeans. I am using the MS-Dos command prompt, and typing the following to
try to pass the variables Var1, Var2, Var3, Var4 into "program_name":

c:\> java program_name Var1 Var2 Var3 Var4 <ENTER>

However, when I type this, I get the following error message: Exception in
thread "main" java.lang.NoClassDefFoundError: program_name

caused by:
etc, etc.

Could not find the main class: program_name. Program will exit
--
View this message in context: http://www.nabble.com/Passing-variables-via-command-line-tp24954902p24954902.html
Sent from the Netbeans IDE Users mailing list archive at Nabble.com.
Back to top
Petr Dvorak
Posted via mailing list.





PostPosted: Thu Aug 13, 2009 2:53 pm    Post subject: Passing variables via command line Reply with quote

Hi,

you should start with some introductory tutorial first - first of all,
the issue you are facing is very unlikely related to command line arguments:

http://java.sun.com/docs/books/tutorial/getStarted/index.html

Also, this issue is not about NetBeans - you would find better answers
on Java forums...

Anyway - you already have your program in NetBeans, right? Invoke
Clean&Build action on the project in the Projects view. Then, open the
command line and navigate to the folder where the project is. There
should be a folder called "dist" in the projects folder - go to the
folder ("cd dist"). You should find a JAR archive there (file with "jar"
extension) - you can run it using:

java -jar MyProject.jar arg1 arg2

With regards,

Petr Dvorak

mplar wrote:
Quote:
Dear all,

I am new to Netbeans and as way of a tutorial, I am trying pass variables
from the command line to a simple programme that I have constructed using
Netbeans. I am using the MS-Dos command prompt, and typing the following to
try to pass the variables Var1, Var2, Var3, Var4 into "program_name":

c:\> java program_name Var1 Var2 Var3 Var4 <ENTER>

However, when I type this, I get the following error message: Exception in
thread "main" java.lang.NoClassDefFoundError: program_name

caused by:
etc, etc.

Could not find the main class: program_name. Program will exit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo