• Post Reply Bookmark Topic Watch Topic
  • New Topic

Line not printed  RSS feed

 
lia mermela
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am new in Java and specifically I am using Java Repast.I have the following in my Main class:



However, I do not get anything displayed in the console.. Could you help me figure out where the problem could be? Also,where should we save the properties file used for initializing some parameters in the model?

Thank you in advance,
Lia
 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Can you please UseCodeTags with some formatting next time? I've added both so it's easier to read your code.
 
lia mermela
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Welcome to the Ranch!

Can you please UseCodeTags with some formatting next time? I've added both so it's easier to read your code.


Thank you!
Yes,I will do that next time : )
Lia
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the run() method do? What output do you expect and what command line arguments are you using?
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean you don't see "Hello, this is my project!" in your console? How are you running the program?
 
lia mermela
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:What does the run() method do? What output do you expect and what command line arguments are you using?


Thank you for replying.
I would expect "Hello, this is my project!" as an output but neither (Transaction)orders.elementAt(i)).qty+(i<orders.size()-1?",":"\n") is printed, as shown below.



Other commands that I am using in the same class is:




I don't get any errors but my program does not run and the csv files are not created at all. My guess is that I am not loading the properties file in the right way or I am not setting the correct pathway when I store it. Also, should I set a pathway for storing in the directory the ordersFile?I am not sure I am doing that correctly..
I apologize for this long message but..I'm a beginner!

Thanks,
Lia>
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You aren't showing us everything you have, and it appears that, if your report is correct, the problem is in something else.

Your main() method does a println first thing; if you don't see that, then you aren't executing that method. Everything is downhill from there.

If you are actually invoking some java class, either it isn't this one or you can't see the console.

Especially at the beginning, consider a simpler program -- printing "Hello World" is the nominal first program. That gets you through creating and compiling the source and running the program, and looking at output on your console. If you can get that to work, then you should be able to invoke this and get the first println string on the console even if none of the rest of it works.

rc

 
lia mermela
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:You mean you don't see "Hello, this is my project!" in your console? How are you running the program?


Thank you.
Yes, I would expect that as an output.I am giving some more info in the previous post,I hope it helps you understand.
Lia
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It isn't enough. If you were running that program correctly, you would see that output.

What is the class that contains main()? Are you running it from a command line? What is the EXACT command you give?

We're willing to help, but guessing more at this stage is just fruitless.

rc
 
lia mermela
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ralph Cook wrote:It isn't enough. If you were running that program correctly, you would see that output.

What is the class that contains main()? Are you running it from a command line? What is the EXACT command you give?

We're willing to help, but guessing more at this stage is just fruitless.

rc




Thank you Ralph.I am including the code for the Main class.




I get only this lines printed in the console:

Hello, this is the supply chain simulation project!");
Usage: Main CustomerOrder.csv
testing my program, hope it works!

Nothing else is printed i.e

-System.out.print(((Transaction)orders.elementAt(i)).qty+(i><orders.size()-1?",":"\n"));
-System.out.println("Printing inventory after processing orders");

and the orders.csv file is not created.

I am confused with the use of the Logger and the properties files. I.e should I store
-CustomerOrder.csv
-Simulation parameter.properties (including WEEK,PERIOD,MEAN,MAD,INFO data)
-retailer.properties
-distributor.properties
-manufacturer.properties

in the project directory so that the values of the parameters included will be initialized?


Sorry for the long message again,I would appreciate your help.
Lia>
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you write that main() method yourself? Can't you see what it is printing? Can you see where that output comes from, like one line lower in the main() method?
What sort of Exception do you suffer thereafter?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!