Using A Button To Run Executable With Arguments
Nov 8, 2014
I am new to JAVA. I need to execute a program, based on the OS. If I am on Mac, the program is a .x and if It is on Windows the program is .exe. The program also requires a line of commands attached to it (i.e. relap5.(x) or (exe) -i inputFile -o outputFile -r restartFile -s stripFile
Here is my coding
String in = " -i ", tfIntdta.getText();
String rst = " -r ", tfRstplt.getText();
String out = " -o ", tfOutdta.getText();
String strp = " -s ", tfStpdta.getText();
if tfStpdta.contains(".csv")
String run = in, rst, out, strp;
else
String run = in. rst, out;
// I want to execute either a .x file or .exe file, depending on if I am
// running the app on windows or mac
run relap5.(x) or (exe) (string run goes here)
View Replies
ADVERTISEMENT
Jun 9, 2014
A method is declared to take three arguments. A program calls this method and passes only two arguments.Will it take the third argument as
1 null
2 void
3 zero
4 Compilation error
View Replies
View Related
Aug 8, 2014
I am trying to uses classes from a non executable jar called noexec.jar in an executable jar called exec.jar. With no defined manifest in the nonexec jar and a manifest in the exec jar. The folder structure where the jars are held look like so.
ROOT
/lib
|
---nonexec.jar
---exec.jar
With the class path defined in the manifest for the executable jar as Class-Path: nonexec.jar . However every time I run java -jar exec.jar, I get Exception in thread "main" java.lang.NoClassDefFoundError: What even though I am including nonexec in my class path why the classes contained within the jar are not being found?
This is the manifest file
Manifest-Version: 1.0
Class-Path: nonexec.jar .
Main-Class: start
View Replies
View Related
Aug 8, 2014
I am working on a card game and for lack of better terms, have royally screwed up my files. I do still have an executable jar that I would like to go back to if possible and try to redo what I messed up. What I was able to do was to use WinRAR and get ?encrypted? class files. Something that is obviously not editable. How can I go about converting these back to editable java files, if possible?
View Replies
View Related
Nov 21, 2014
So let's say i have an executable jar and inside that jar is a bunch of files. How do I access files within my jar?
Assuming like, a main class is currently running and that is what's inside the manifest file as the main class inside that executable jar..
View Replies
View Related
Apr 15, 2015
I made a project in eclipse and exported it with libraries into a jar file.
Now I need to obfuscate that jar file so it can't be reverse engineered or anything.
I just need something basic. Just where I put the jar file as input and it will output another jar file that is obfuscated.
I looked at proguard but it looks complex for something like this. I don't want to be spending ages making config files or anything... What I should use?
View Replies
View Related
Dec 25, 2014
when I am programming let say in VB using Visual Studio, finally I build .exe file that can be run on all Windows by double click.For Java I am using Eclipse and to run those apps I am using run from Eclipse.How I can create a sort of "executable" for my Java app that I would be able to run it by file click on Windows or Linux?
View Replies
View Related
Feb 20, 2014
Embedding an executable .jar file on a webpage. I am not a programmer and we use Blackboard Publish to package our Blackboard sessions into a standalone executable .JAR file which gives the user the full Blackboard experience. We want to embed this file on our webpage, so I did some research and I understand I have to use a Japplet (?). I have tried putting the basic (J)applet code I found on the web (modified of course) onto the webpage (see code below) but I get a 'ClassNotFoundException' error. I don't have the ability to define the files that are in the .JAR created by Blackboard Publish. How I would go about embedding this file? I can look at the files within the .jar with Winzip but there seem to be loads of .class files and I am unclear which one my webpage is trying to find!
<APPLET CODEBASE="/Blackboard/" ARCHIVE="test.jar" CODE=test.class WIDTH=140 HEIGHT=45>
<(J)APPLET>
View Replies
View Related
Aug 7, 2014
how run the executable jar files using JButton from another class file.I need, when i click the button then the executable jar file should be and display the output.
View Replies
View Related
Jan 27, 2014
I have a little application that I made, it requires that I save data to a file in data/coins.cdp. When I run the application with java myProg in the terminal everything is correct, when I create the executable jar and run java -jar myJar.jar or ./myjar.jar everything also works. Even if I copy the jar to a different location, and run it through the terminal, it still works fine. Things get weird through when I copy the jar to a new location and double click on it, because then no folder gets created and no file is written.
Why is that?
View Replies
View Related
Feb 11, 2015
I have an executable jar file that I decompile using androchef. I have to use androchef otherwise I get to many errors especially with jd-gui. I need to know how to export the files after I have decompiled them with androchef so that I can edit a file then send to netbeans and rejar.
View Replies
View Related
Apr 16, 2015
I have tried to get my dinky little program I wrote to be stored as an executable through Eclipse to no avail. It seems I have tried everything else as well, to no avail. I do not want it to go through command prompt, but rather have it be its own entity. As you can probably tell my knowledge of Java and coding is limited, but always willing to expand.
View Replies
View Related
Oct 25, 2013
I am wondering if there is an easy way to create a java exe(cutable) binary, by packing the JRE and ship it like a compiled C++ bin file? I know JAR is good but, I still prefer to create a standalone install - free exe, no matter if the user has or has not Java installed on her PC.
View Replies
View Related
Jul 10, 2014
I'm trying to run a command line executable file using java but there is no output. On the task manager a conhost process opens when the application is run. I've tried
1)try {
Runtime.getRuntime().exec("D: est.exe");
} catch (Exception e) {
e.printStackTrace();
}
2)String[] cmd = { "D: est.exe"};
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
and
3)//Runtime.getRuntime().exec("D: est.exe", null, new File("D:"));
same thing happens i.e. nothing happens.
View Replies
View Related
Jun 18, 2014
I have one Project -"A".Inside of that I use, .XLS to read data.
Structure - A/src/TestData
Inside of the TesetData - I have placed XLS files.
I have main method in TestDriver class.If I run this in Eclipse, running fine.But after exported to executable/runnable Jar, and ran via command line (command - jar -jar myjar.jar), I see issue: "Exception in thread "main" java.io.FileNotFoundException: srcTestDataTestCaseController.xls"
public static void main(String[] args)
throws Exception
{
ResultSet rs;
rs = readExcelData(testControllerName, sheetName, "");
}
As I use main() method which is static, I am getting error if I write like the below:
public void getXls(){
String testControllerName ="TestCaseController.xls"
TestDriver.getClass().getClassLoader().getResource (testControllerName);
}
How to read/access the XLS, after I exported as runnable jar
View Replies
View Related
Aug 1, 2014
I was wondering if their is an easily explainable way to convert a jar for a text-based game that runs off the command prompt into a executable. I would guess there probably is not and the game would have to run off of completely different commands, but I thought it couldn't hurt to ask.
View Replies
View Related
Feb 16, 2014
I am totally new to java. How to convert the below java code to an executable file?
var intInterval = 0
function importdata(){
filename = "C:1.txt";
AmiBroker1 = new ActiveXObject("Broker.Application" );
AmiBroker1.Import( 0, filename, "custom.format" );
AmiBroker1.RefreshAll();
}
It simply imports numerical data from 1.txt into an application amibroker. Also this import function has to be in a loop of 60 seconds.
View Replies
View Related
Apr 14, 2015
I have made a simple h2 db viewer using jdbc and in eclipse it has a horizontal scrollbar so it works and displays correctly.
When I run the jar from cmd it works as it should but the results all go onto new lines so all formatting is lost and it looks.. ugly...
somehow make it so the console has a forced horizontal scrollbar but dunno how.
View Replies
View Related
Apr 1, 2014
I've been trying to deploy my desktop application as an executable jar file but I'm facing the following problem: Whenever I move the jar file from its original build location, my application becomes unable to write to its external files. I initially thought the problem was path related; however, when moved the app can still load data from these files.
The solution is probably simple but for some reasons I've yet to find it .
The app consists of a jar file and a folder named "files" containing text files (such as library.data) to which serialized objects are written.
I wouldn't be surprise if the problem has to do with the xml build file, but all modification I've tried so far have failed. If it is likely that it is the problem, I'll be happy to post a copy of it upon request.
public static void saveLibraryToFile() {
File file = new File(System.getProperty("user.dir")+"fileslibrary.data");
if (file != null && file.exists()) {
library = new Library(sortedAccounts, accountCategoriesMap, accountCategoriesList);
[Code] ....
A mostly complete set of the relevant codes I'm using, including the full Ant xml file, can be found at : [URL] .....
View Replies
View Related
Oct 16, 2014
The gist of it is to create a very basic memory game. There are 12 buttons, each associated with an icon. Every button that you click will display the icon and will stay there until clicked again. I got the bulk of it taken care of, but my issue lies with switching the icons back and forth. I can get them to display one at a time, but when I click on a new button, all the icons except the button I just clicked don't display. Essentially, only one shows up at a time.
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.SwingConstants;
[code]....
View Replies
View Related
Feb 24, 2015
I am using JS, how we can make focus to a button during onload, the button need to get focus which is in tabbedPane tab Name : (Search Critera1) using javascript.
View Replies
View Related
Dec 27, 2014
I am going through Thinking in Java, 4th Ed and I came across the section that talks about overloading variable arguments. I tried out a piece of code from the book. (Method and class names not exactly the same).
public class Varargs
{
public static void m1(Character... args)
{
System.out.println("Character");
[code]....
In the above code, the compiler throws an 'Ambiguous for the type varargs' error. The error goes away if the first method is changed to:
public static void m1(char c, Character... args)
why there is ambiguity in the first piece of code and not the second.
View Replies
View Related
Sep 14, 2014
i have to run my program from the command line...My code is:
public static void main( String[] args )
{
// check command-line arguments
if ( args.length == 2 )
{
// get command-line arguments
String databaseUserName = args[ 0 ];
String databasePassword = args[ 1 ];
[code]....
Now everything works in Netbeans but running it from the command line, i get an error message ".java uses unchecked and unsafe operations".I have added a bit more code to the code above
for (int i = 0; i < args.length; i++) {
System.out.println("args[" + i + "]: "
+ args[i]);
}
Just not sure how to run it from the command line,
View Replies
View Related
Sep 29, 2014
I have been able to create a no arg constructor and pass empty double, int, and strings but i am not able to pass an arraylist.
class Savings {
private double balance;
private ArrayList <String> transaction = new ArrayList();
public Savings (double B)/>
{
balance = b;
}
public Savings()
{
this(0.0,new ArrayList());
}
View Replies
View Related
Sep 16, 2014
I have a JButton with a .PNG icon on it. I want to get that button click in actionPerformed Method but Jbutton have no Label... How i will know that which button clicked?
View Replies
View Related
Apr 22, 2015
I am writing a simple program in Java, where I call a method and pass some variables (namely, min and max) as arguments. This method is recursive, so the same arguments are again passed on in each recursive call.
I need to update these variables in recursive calls so that when the calling method uses them, it uses updated values. As it might sound confusing, here is sample code :
// Function 1.
void func1() {
//Call func2.
func2 (int hd, int min, int max, Map<String, String> map);
//Other stuff.
}
// Function 2.
[code]....
As you can see, min and max are updated after each recursive call returns, based on conditions. However, these changes aren't reflected in original min and max, which were used by func1 while calling func2. As far as I know, this happens due to call by value mechanism being used by Java while passing arguments. If I declare min and max as instance variables in the class, my problem is solved. But, I want to know whether there's any other way to update these variables so that changes in original min and max are reflected. Yes, I can return them as an array of 2 elements each time while returning, but it didn't seem a good solution to me.
View Replies
View Related