Making a Java Console Application - java

I wonder if it's possible to create a java console application where someone can download my packages, run and use that application in Command Line/Terminal or with some other console application.
I am very well versed in Java & the reason I'm asking is, I have a chess game which I have made to be run in command line, but how do I get it to run like an application?
To wit: On a mac, just like one who has Home brew can download formulas and use their specific commands to begin and run them, how can I do this for an already made application. Do I need a config file? Or is it just good to go as it is.
So I don't want someone to download the package and have to use the "javac/java" command to compile and run it, but can just say something like "run chess" and it does so. Any help or resources would be appreciated

You need to convert your .jar to .exe
There is a lot of software doing this, for example JSmooth.
You need to choose the starting application class and then run it.

Related

IntelliJ IDEA Run applications

Excuse me, the Run applications of IntelliJ IDEA in the picture below have questions about variables.
After the Run applications are running, will they save the previously executed variables like the JShell console of IntelliJ IDEA, and they can be used in the next execution?
I want to know whether Run applications has such a function, or only JShell console can do it.
If you click on the arrow present just after Current File, you will find an option called Edit Configurations. There you can add your own variables for running your application. And yes, you can save your configuration using the Save TEST_CLASS_NAME Configuration.

Pin a Java program created with Netbeans on taskbar?

Good evening!
I want to create a program in NetBeans which I can pin to my taskbar without detours. I just want to pull the program in my taskbar, but if I just build the project it isn't possible. Can someone tell me, what I have to add to my code or what do I have to click in NetBeans to be able to do this?
Thanks!
If you want to run your code without using IDE, you can use the command prompt to do this, or you can make an .exe file of your code, so you can run it as a windows application (with the double-click).
Here is the name of some programs that convert java file to .exe file:
JSmooth - JarToExe - Executor - Advanced Installer - Launch4j - Install4j
Hope this help.
You can even build the project as a standalone .jar file, and then simply create a shortcut to the file and pin it to your taskbar that way.
I haven't used NetBeans in ages, but in eclipse it's under the export menu.

Terminal edited files cannot be run by eclipse

I am using eclipse on linux, and I have mostly been writing java files by editing the raw text file. My reasoning behind this is that I am in a comp sci course, and we have to write code by hand, so this will prepare me for writing code unaided. However, my actual problem arose when I tried to edit a file I had created using eclipse 3.8.1. When I tried to open the folder, which has the same structure as files created by eclipse if it matters, it opens, but I cannot run it. When I click run, it asks what to run it as, and the only 2 options are Ant Builds. I don't know what this means, but I am not able to run the file either way. Any help is appreciated, and if it is important, I am using java 8.

Easy way to make a runnable program out of a java project

Im doing a small Java project with some school kids to teach them programming and at the end of this project hopefully we will have a small Game.
I would like to give these kids some sort of "exe" file(on an USB-Stick) that should run if you double click it.
I can produce a .jar file, but that wont execute on double clicking it.
The first thing i can think of is a .bat file with java -jar [game.jar] as content but this would require an installed JRE.
Is there any better(but not too complex) way to generate a file(or directory with file in it) that could run anywhere(on Windows is enough) like a portable JRE?
The best solution would be a single File like a self-extracting zip.
You can use Launch4j, it makes an .exe which tries to run the program and if no JRE is found it leads them to the download page of the JRE. I'm just not sure if it can make an .exe with embedded JRE.
Their website: http://launch4j.sourceforge.net/
Because you are using Java, which is dependent on the JRE to run, you are not going to get around not having the JRE installed without significant legwork. Just package instructions with the flash drives you give the kids!
If you're committed though, look into http://www.excelsiorjet.com/ or http://www.duckware.com/jexepack/index.html.
As well as this SO question: How can I convert my Java program to an .exe file?
I can produce a .jar file, but that wont execute on double clicking it.
Why doesn't this work? Is it an issue with having a JRE present, and that these kids might not have it, or might not be able to install it on other's machines?
I suggest you go here if you want go the "exe" route.
http://www.excelsiorjet.com/free
if you click "free licenses" you can get apply for a free license of I believe the "standard edition."
This should be "Good enough" for your intended purposes, and you wont need a JRE present.
It's more work on your end, but it should work nicely for your needs.

Compiling and running a C++ program from a Java application

i need to run a cpp propgram from a java application.
I have Visual Studio and Eclipse.
I have all of the cpp files and also a .mak file which i'm not sure about how it could help me...
any help or direction would be welcome!
Do you want to actually run the final application? This seems more like you want to build it.
Either way you can use:
java.lang.Runtime.getRuntime().exec(command, environment)
To run a process from Java like running it from a console.
See http://java.sun.com/javase/6/docs/api/index.html?java/lang/System.html for details.

Categories