Open ZvikaZ opened 3 years ago
The problem here is that the tutorials were built back when ECJ was run as a directory of class files rather than as a jar file of them. You can still do that! But yeah, we need to update the tutorials.
Sean
On Mar 18, 2021, at 9:43 AM, Zvika @.***> wrote:
Hi. I'm trying to go through the very first tutorial, and seems that there's a missing step in the basic documentation.
I've first installed according to the instructions at https://github.com/GMUEClab/ecj/tree/master/ecj , and tested the installation with
java -jar target/ecj-27.jar -from app/tutorial3/tutorial3.params
and it run well.
Now, I've gone to the first tutorial, (opened it locally - ecj27/ecj/ecj/docs/tutorials/tutorial1/index.htm) It says: The tutorial described here assumes that you have already set up ECJ's classpath and understand how to run the example problems. Well, I haven't already set up ECJ's classpath (it wasn't explained anywhere...), but since I understand how to run the example problems, I assumed that it's not really important...
Next, it says Go into the ec/app - what exactly does this mean?
[~/projects/ecj/ecj/ecj]$ find . -name "app" ./src/test/java/ec/app ./src/main/resources/ec/app ./src/main/java/ec/app ./target/classes/ec/app ./target/test-classes/ec/app
Anyway, running
java -jar target/ecj-27.jar -from app/tutorial1/tutorial1.params
Is working, so it's probably one of these, and it does contain the tutorial1.params file. Great.
$ find . -name "tutorial1.params" ./src/main/resources/ec/app/tutorial1/tutorial1.params ./target/classes/ec/app/tutorial1/tutorial1.params
Only two options - not bad.
Doing the old trick, of adding random characters (dwfdsfdsfdsf) at the beginning of both files, and running again to make sure that it fails with errors - but both of them run correctly...
So, what's going on?
Then I've noticed that at the end of the tutorial it says:
Close the MaxOnes.java file and compile it. If you're inside the tutorial1 directory, you can run it by calling:
java ec.Evolve -file tutorial1.params
Hmm. Different command? Tried it - it fails. Probably because of the classpath issue, from the beginning...
So, to summarize, it seems that either the installation, or the first tutorial (or both), need some clarification:
• classpath setting • java ec.Evolve -file vs java -jar target/ecj-27.jar -from • where is app directory? • what are these existing tutorial1.params files? (and why are they duplicated?) Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
So, what's the correct modern way?
Should I set CLASSPATH
?
Should I run with java -jar target/ecj-27.jar -from app/X
?
Where exactly is this app
dir?
By setting CLASSPATH
to /ecj/ecj/target/classes
, it's working (with java ec.Evolve -file tutorial1.params
).
But I'm still curious how can I run it with java -jar target/ecj-27.jar -from app/X
Hi @ZvikaZ ,
In general, you won't need to set the CLASSPATH
if you are running from the jar (since the Jar knows where to find itself and the dependencies in target/lib/
). But you do if you want to use the java ec.Evolve
syntax.
The different directories you're seeing are the result of a couple standards in Java land:
target/classes
is the result of compilation. In our case we copy the .param files there automatically as an intermediate phase in building the jar. So it's a compilation product---they'll get nuked when you rebuild, so you don't want to edit those.src/test
, src/main/java
, and src/main/resources
are the folder organization enforced by Maven. They contain unit tests, code files, and everything else, respectively.The tutorial hasn't been updated since we switched to using Maven, thus the confusion!
tl;dr, The directory you want to work with for parameter files i src/main/resources/ec/app
!
Oh, and I'd recommend running with
java -jar target/ecj-27.jar -file src/main/resources/ec/app/tutorial1/tutorial1.params
Oh, and I'd recommend running with
java -jar target/ecj-27.jar -file src/main/resources/ec/app/tutorial1/tutorial1.params
Thanks, that's working.
But I think that even better would be:
java -jar FULL/PATH/TO/target/ecj-27.jar -file tutorial1.params
which can be run from any directory. Thus, separating user's code from ECJ. Making it easier for git, etc.
BTW,
I think that not only the tutorial should be updated, but also https://github.com/GMUEClab/ecj/blob/master/ecj/README.md
, as it doesn't suggest the -jar ... -file
syntax.
And also the big manual should be updated to reflect Maven organization.
Hi. I'm trying to go through the very first tutorial, and seems that there's a missing step in the basic documentation.
I've first installed according to the instructions at https://github.com/GMUEClab/ecj/tree/master/ecj , and tested the installation with
and it run well.
Now, I've gone to the first tutorial, (opened it locally -
ecj27/ecj/ecj/docs/tutorials/tutorial1/index.htm
) It says:The tutorial described here assumes that you have already set up ECJ's classpath and understand how to run the example problems
. Well, I haven'talready set up ECJ's classpath
(it wasn't explained anywhere...), but since Iunderstand how to run the example problems
, I assumed that it's not really important...Next, it says
Go into the ec/app
- what exactly does this mean?Anyway, running
Is working, so it's probably one of these, and it does contain the
tutorial1.params
file. Great.Only two options - not bad.
Doing the old trick, of adding random characters (
dwfdsfdsfdsf
) at the beginning of both files, and running again to make sure that it fails with errors - but both of them run correctly...So, what's going on?
Then I've noticed that at the end of the tutorial it says:
Hmm. Different command? Tried it - it fails. Probably because of the
classpath
issue, from the beginning...So, to summarize, it seems that either the installation, or the first tutorial (or both), need some clarification:
classpath
settingjava ec.Evolve -file
vsjava -jar target/ecj-27.jar -from
app
directory?tutorial1.params
files? (and why are they duplicated?)Thanks