c++,python but have no experience working with java files. I found some tools suporting my work in python but they are in java .This is the code source
https://github.com/OneBusAway/onebusaway-gtfs-realtime-from-siri-cli/tree/master/src/main
Can anyone give some guidance on how to build or run these source files.
thanks
just clone the source from GitHub and import it to java IDE example; Eclipse, IntelliJ, Netbeans. to run just click the run button.
https://www.wikihow.com/Run-Java-Program-in-Eclipse for eclipse
you can also use command prompt without installing some IDE but make sure your device already installed java
open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram.java). Assume it's C:.
Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).
Now, type ' java MyFirstJavaProgram ' to run your program.
You will be able to see the result printed on the window.
Get these sources: clone the project
The project is build with Maven, so you need to install it.
Dig into pom.xml (Maven build configation file) and find out, which version of Java it requires
Install porper version of Java SDK
Armed with Maven documentation, build an executable file out of the sources
Related
So I'm working on a project as an intern and it involves atom and Github so I pulled the coding down to my desktop and have all of that set up. So how do I launch the code so that it will allow me to test the code?
You will want to make sure you have Java install on your machine, and the move into your directory, then compile the program by doing javac filename.java This should be the file with the main method in it. That will generate a class file, then you can just do java filename.
Alternatively, you could download Eclipse and import the project in and run the test in the IDE. This would also allow you to write your own tests, or modify them if you need. https://www.eclipse.org/downloads/ and the Neon version will probably work fine for you.
As a newbie to programming, I am finding it really quite difficult to install all the necessary software and such to get everything running.
Up until now I have been using the command prompt and javac along with gedit to edit/compile my code, but we are meant to be using eclipse and then JUnit to test it.
I have just managed to get eclipse working, but still stuck as to how to get JUnit working.
I am stuck on the installation part...
The JUnit FAQ (http://junit.sourceforge.net/doc/faq/faq.htm#started_1) states...
Windows
To install JUnit on Windows, follow these steps:
Unzip the junit.zip distribution file to a directory referred to as %JUNIT_HOME%.
Add JUnit to the classpath:
set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar
How can you "unzip" the "junit.zip distribution file" to the directory "%JUNIT_HOME%" and how do you add something to the classpath? Where is this class path? I tried extracting the zip folder and typing "%JUNIT_HOME%" into the directory, but it says the destination path is invalid, so I assume this is not what the instructions mean.
Apologies for the noob-questions... I'm finding this technical jargon difficult to find my way around.
Any hints for the next steps for installing JUnit will also be appreciated, as I will likely get stuck on those too.
If you are using Eclipse, please import the junit.jar file to your classpath in your project. You can do it by right+click on the project and choose Properties -> Java Build Path. and add you jar file.
I have an ant script which compiles java code and executes it but when I run it on a machine where ant is not installed it does not execute nor compile. Is there any way to do this?
Thanks
No, there is no way to do this.
Basically, running a program require having this program installed. No mater what program it is.
Copy bin and lib directories from a Ant -package to your project path and run "bin\ant".
Or for example you project path could contain:
build.xml
src
software\ant\bin
software\ant\lib
You can run "software\ant\bin\ant" in you project path.
You can try to create something similar to the gradle wrapper for ant.
Basically, it's a batch/shell script and a simple jar that only need a valid JAVA_HOME to run. When you launch this script it download gradle if required (i.e. not already available at a well known location), then it execute your gradle build.
Imagine someone saying, "I have a C/Python/Perl/C++/Whatever program I want to compile. Is there anyway to compile that C/Python/Perl/C++/Whatever program without having to install C/Python/Perl/C++/Whatever?"
The answer would pretty much be no. You need Ant to interpret the Ant build files.
Fortunately, installing Ant is pretty straight forward. You download the ZIP file from Ant's Distribution Page, then unzip it into some directory (preferably one without spaces in the name. C:\Program Files\Apache Ant isn't a good choice, but C:\apache-ant would be fine.
Now, you set two environment variables, ANT_HOME pointing to where you installed Ant, and JAVA_HOME pointing where you installed the Java JDK. (Windows comes with the Javaruntime, but you need to have the Java JDK which you can get from Oracle.) This can be done by going into the System Control Panel->Advanced
WARNING: When installing Java Developer Kit (JDK), be very, very careful not to accidentally install the Ask Toolbar. Java does this by default.
Once that is done, set your PATH (again via the PATH Environment variable to include %ANT_HOME/bin and %JAVA_HOME%/bin at the beginning of your path.
Then, running ant on the command line in a Console window will run Ant. The whole procedure takes about 10 minutes to do.
I have to write some little programs in Java for school, so I don't want all that stuff that Eclipse generates with a new project. The way I'm doing it now is this:
$ touch myprog.java
open and edit myprog.java in Eclipse
$ javac myprog.java
$ java MyProgClass
The problem is that Eclipse doesn't show warnings and errors while typing the code. It would also be nice if it would let me compile and run the file inside Eclipse (by doing what I do above in the working directory).
Is there any way I can make Eclipse do this?
This is because Eclipse doesn't consider your .java file as something it should compile (and thus generate errors for)
You need to mark the folder containing myprog.java as a source folder. Here's how you do it:
Right-click on the folder and choose "Build Path" -> "Use as source folder".
Well because now it's just a text file for eclipse and it isn't linked to java project.
Create new project and put myprog.java to /src folder in eclipse project.
Then:
$ javac workspace/yourpoject/src/myprog.java
$ java workspace/yourproject/bin/myprog
As a result copy only those 2 files and ignore the rest of project files if you want.
Can't you use an existing project into which to create school classes?
Alternatively the NetBeans IDE is somewhat slimmer. You would use Run File there.
The short answer: no, you can't make eclipse do that.
Eclipse JDT needs to know the classpath to compile (even if that classpath only includes the JRE), builders to tell you if there are errors, and the search engine for standard IDE things like content assist or open declaration.
It's trivial to create one java project, and then use that to create all of your little java programs. They compile correctly, report errors, and are easy to run ... and if you want to run them from the command line as well, there's nothing stopping you.
I am a student at a local university in Atlanta , Georgia. I am looking for incorporating Weka.jar file to my eclipse for my class project.
I have tried many time to incorporate the weka-3.4.jar file into our java build path in java project using Eclipse.
Each time, my program gave me an error saying that weka.core could not be resolved from my import statement in my java test program.
It seems very obvious that i did missed something very important but i could not figure it out.
If you know what 's happening, i would like to seek your help, please tell me what to do in order to fix this error message.
You can get weka jar file from the weka file
just go in program file => weka folder => there are 3 jar files. So you can add to your eclipse. Then,
go to your eclipse project then build path and add in libraries there,
it works!
Do you compile and run your program using Eclipse ("Run") or do you use the command line? If you use Eclipse to run your program you should add the jar file in your project properties under "Java Build Path" > "Libraries" > "Add external JARs...". When using the command line, use the -jar parameter, e.g., java -jar path_to_file/weka-3.4.jar yourprogram