• Post Reply Bookmark Topic Watch Topic
  • New Topic

Add source to a .bat file?  RSS feed

 
Larry Evers
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have the following .bat file that compiles the ReadMindWave.java source with jna and jfreechart. I get a javac error saying 'no source' when the .bat is run, as the .java source needs to be included in the .bat file. Any idea where it goes in the following .bat file?

@echo off
echo Compiling %1 with JNA and JFreeChart...

javac -Xlint:deprecation -cp "C:\jna-master\*;C:\jfreechart-1.0.19\lib\jfreechart-1.0.19.jar;C:\jfreechart-1.0.19\lib\jcommon-1.0.23.jar;."%*

The file to compile is in C:\MindWaveTests\ReadMindWave.java

Any ideas appreciated.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need a space before the %*
javac -Xlint:deprecation -cp "C:\jna-master\*;C:\jfreechart-1.0.19\lib\jfreechart-1.0.19.jar;C:\jfreechart-1.0.19\lib\jcommon-1.0.23.jar;." %*
 
Larry Evers
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. So it would look like this?

javac -Xlint:deprecation -cp "C:\jna-master\*;C:\jfreechart-1.0.19\lib\jfreechart-1.0.19.jar;C:\jfreechart-1.0.19\lib\jcommon-1.0.23.jar;." %*;C:\MindWaveTests\ReadMindWave.java


 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Larry Evers wrote:Thanks for the reply. So it would look like this?
javac -Xlint:deprecation -cp "C:\jna-master\*;C:\jfreechart-1.0.19\lib\jfreechart-1.0.19.jar;C:\jfreechart-1.0.19\lib\jcommon-1.0.23.jar;." %*;C:\MindWaveTests\ReadMindWave.java

No. It looks like how I put it in my post. You pass the name of the source file in as a parameter to the batch file. The %* represents all command line parameters.
Assuming your .bat file is called compile.bat, the command line would be
compile C:\MindWaveTests\ReadMindWave.java

Of course, if the only time you use this file is to compile C:\MindWaveTests\ReadMindWave.java, then you could just change it to

@echo off
echo Compiling C:\MindWaveTests\ReadMindWave.java with JNA and JFreeChart...

javac -Xlint:deprecation -cp "C:\jna-master\*;C:\jfreechart-1.0.19\lib\jfreechart-1.0.19.jar;C:\jfreechart-1.0.19\lib\jcommon-1.0.23.jar;." C:\MindWaveTests\ReadMindWave.java
 
Larry Evers
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, that much makes sense, you type in the .bat file name and point it to the source to be compiled. That gave me four errors unfortunately. Looks like some resources like the jna are not being found. This is a program to exercise a NeuroSky Mindwave EEG so it uses their dev kit "MDT", the jna & jfreechart. Not sure if I should mark this resolved or not. I do get how to run the .bat file by pointing to the source.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!