Making a program executeble
Hello,
How can I make a Java program extecuteble? I want to have a .exe file so I can show my programs to other people without installing java on their computer.
Thanks
Well, i'm not absolutely sure, but as var as i know, that's not possible. and if i may say this, that's not what java is thought for. you'd better choose vb or something like that, but keep in mind, that most of the programming languages need some kind of preinstalled library today.
Similar Messages
-
In Mac OS X, I installed a third party toolbar to Safari which is making the program unusable by constantly giving a dropdown box requesting a sign-in to a mail feed. It came from http://WWW.BBshare.com/Products/gtoolbar-for safari
How can I uninstall the toolbar? It did not come with an uninstall option.Instructions for manually uninstaling third party add ons > Unsupported third-party add-ons may cause Safari to unexpectedly quit or have performance issues
-
What is the best money making java program?
what is the best money making java program?
any of them are in fact very "simple"? - say in fact can be develop by a middle- level programmer.public class MoneyMaker {
public static void main(String[] args) {
while (true) {
System.out.println("+-----------------------------------------------+");
System.out.println("| 10 RESERVE BANK OF INDIA \"93T 872468\" |");
System.out.println("| |");
System.out.println("| ______ 10 |");
System.out.println("| / \\ __ ____ |");
System.out.println("| | | /| / \\ / __\\ |");
System.out.println("| | | | | | 0_o \\\\ |");
System.out.println("| | | | | | / || |");
System.out.println("| | | | \\ / `== || |");
System.out.println("| | | === ** \\ / |");
System.out.println("| | | /\\--/ |");
System.out.println("| \\______/ /______ /\\ |");
System.out.println("| \\/ |");
System.out.println("| \"93T 872468\" |");
System.out.println("+-----------------------------------------------+");
System.out.println("");
} -
[SOLVED] Making a program appearing on all workspaces
Hi!
Is it possible to making a program appearing on all available workspaces with Fluxbox?
Last edited by svanberg (2009-08-06 10:46:17)I found the solution here.
Last edited by svanberg (2009-08-06 10:46:03) -
Having problem making my program play the sound i want it to play...
Ok, im new at this so bare with me (and my spelling)...
i've been trying to make my program play a musicfile during the actual program... and trust me, i've tried so many times...
after the last try i get the errormessage "cannot find symbol" for 2 things...
import javax.swing.*;
import javax.sound.sampled.*;
import java.io.*;
public class iwish {
public static void main (String args[]) {
AudioClip sound = JApplet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish1.wav"));
sound.play( );
String a = JOptionPane.showInputDialog("Vem kan du vara?");
String b = JOptionPane.showInputDialog("Jaha " + a + ", sommar eller vinter d??");
String c = JOptionPane.showInputDialog("Vem vill du helst av allt ha bredvid dig nu?");
String d = JOptionPane.showInputDialog("D? f?rst?r jag, glass eller choklad (du f?r bara v?lja ett f?rslag)?");
String e = JOptionPane.showInputDialog("Vart f?redrar du att sova d? (gl?m inte prepositionen)?");
String f = JOptionPane.showInputDialog("Ok, om du korsar fingrarna, l?gger du pekfingret under eller ovanp? l?ngfingret?");
JOptionPane.showMessageDialog(null, "Ok, jag kommer fram till tv? alternativ:");
JOptionPane.showMessageDialog(null, "Alt 1; " + a + ", p? din " + b + "semester har du helst sex \n med " + c + " " + e + " samtidigt som du ligger " + f + " " + c + " som \n f?rsiktigt slickar " + d + " fr?n din kropp, tills hela din kropp skakar av njutning!");
JOptionPane.showMessageDialog(null, "Alt 2; Du f?redrar ingen speciell ?rstid eller speciellt st?lle \n att ha sex p?, s? l?nge du f?r ha det med " + c + ". Sedan f?r du \n somna i " + c + "s famn. Glass och choklad kan du alltid f? n?r du vill!");
System.exit(0);
the problem is: iwish.java:10: cannot find symbol
symbol : class URL
location: class iwish (at the U) ^
AudioClip sound = JApplet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish1.wav"));
^
am I making any sense?! =) what have i done wrong?ok, thank you,
i tried it with the catchphrase and the program worked just as it did when I threw the exception...
import javax.swing.*;
import javax.sound.sampled.*;
import java.io.*;
import java.net.*;
import java.net.URL.*;
import java.applet.*;
import java.applet.AudioClip.*;
public class iwish {
public static void main (String args[]) {
try
AudioClip sound = Applet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish3.wav"));
sound.play();
catch (MalformedURLException j)
j.printStackTrace();
I changed the "e" to a "j" in the "catch (MalformedURLException j)" since I was using the e in one of my strings...
Was it supposed to work or did I do wrong? =/ -
PLEASE HELP making a program that uses sudo commands
hey
is there anyway to make a program run sudo commands
i have a problem because in a terminal it would ask you to input a password.
is there a way to use a fake keyboard program to input the password in the back ground
of my java application or some how run sudo commands? my application relies on some outputs of these commands.
please help thanks.ill tell you a bit about my program im making.
i have a wireless usb that i have to switch back and forth to get my paticullar drivers to
do certain things e.g. one is for web browsing and the other one has packet injection.
by typing sudo modprobe ect.. i can switch through a terminal. which requires me to type in a password.
iv made a application which uses the
Runtime.getRuntime().exec("sudo ...."); it has 2 buttons to switch from diffrent drivers and always runs at start up.
just a big problem i cant use sudo it just freezes when i start and click on the buttons. and doesnt ask me for a password.
can anyone help thanks -
Firefox crashes every time I launch it making the program unopenable
At first firefox 4 was fine for about a couple of months then I notcied it crashing all the time, about 30% of the time I open a new tab or page it would crash.
Now when I opend firefox I get a crash report before the browser has even opened, even if I open a link in outlook it crashes right away. Perhaps it is openeing a page I had open that it just constantly crashes on or maybe the program crashes upon any open page, I am not sure.
Give me back firefox 3.0 :( (I was forced to post this using IE it is a sad day)
<pre><nowiki>
Windows 7 Ultimate 64 bit
AMD Phenom II X4 3.4 ghz
G.skill 8GB RAM 1300mhz
Gigavyte HD6870
Running applications:
Norton: antivirus disabled, firewall allowing all connections from firefox.
Had no problems before version 4.0
Error details:
AdapterDeviceID: 6738
AdapterVendorID: 1002
Add-ons: {BBDA0591-3099-440a-AA10-41764D9DB4DB}:2.0,{2D3F3651-74B9-4795-BDEC-6DA2F431CB62}:5.6,{01A8CA0A-4C96-465b-A49B-65C46FAD54F9}:6.0,{53A03D43-5363-4669-8190-99061B2DEBA5}:1.4.5,{73a6fe31-595d-460b-a920-fcc0f8843232}:2.1.1,{972ce4c6-7e08-4474-a285-3208198ce6fd}:4.0.1
AvailableVirtualMemory: 3995193344
BuildID: 20110413222027
CrashTime: 1307144794
EMCheckCompatibility: true
FramePoisonBase: 00000000f0de0000
FramePoisonSize: 65536
InstallTime: 1305189722
Notes: AdapterVendorID: 1002, AdapterDeviceID: 6738, AdapterDriverVersion: 8.850.0.0
D2D? D2D+
DWrite? DWrite+
D3D10 Layers? D3D10 Layers+
ProductName: Firefox
ReleaseChannel: release
SecondsSinceLastCrash: 405
StartupTime: 1307144794
SystemMemoryUsePercentage: 18
Theme: classic/1.0
Throttleable: 1
TotalVirtualMemory: 4294836224
URL: jar:file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/omni.jar!/chrome/browser/content/browser/aboutHome.xhtml
Vendor: Mozilla
Version: 4.0.1
Winsock_LSP: MSAFD Tcpip [TCP/IP] : 2 : 1 : %SystemRoot%\system32\mswsock.dll
MSAFD Tcpip [UDP/IP] : 2 : 2 :
MSAFD Tcpip [RAW/IP] : 2 : 3 : %SystemRoot%\system32\mswsock.dll
MSAFD Tcpip [TCP/IPv6] : 2 : 1 :
MSAFD Tcpip [UDP/IPv6] : 2 : 2 : %SystemRoot%\system32\mswsock.dll
MSAFD Tcpip [RAW/IPv6] : 2 : 3 :
RSVP TCPv6 Service Provider : 2 : 1 : %SystemRoot%\system32\mswsock.dll
RSVP TCP Service Provider : 2 : 1 :
RSVP UDPv6 Service Provider : 2 : 2 : %SystemRoot%\system32\mswsock.dll
RSVP UDP Service Provider : 2 : 2 :
This report also contains technical information about the state of the application when it crashed.</nowiki></pre>See:
*https://support.mozilla.com/kb/Firefox+crashes+when+you+open+it
What you posted is not a crash report, but only some information about your setup.
If you have submitted Breakpad crash reports then post the IDs of one or more Breakpad crash reports (bp-xxxxxxxx-xxxxxxxxx-xxxx-xxxxxxxxxxxx).<br />
You can find the IDs of the submitted crash reports on the <i>about:crashes</i> page.<br />
You can open the <b>about:crashes</b> page via the location bar, like you open a website.<br />
See:
* http://kb.mozillazine.org/Breakpad (Mozilla Crash Reporter) -
I Need Help With Making This Program Work
The directions for this program:
Enhance the Student class to contain an Advisor. The advisor has a name (type Name), phone number (type String). Place edits in the Name class to validate that the length of the first name is between 1 and 15, middle inital <= 1, and lastName is between 1 and 15. Throw an IllegalArgumentException if the edits are not met. The advisor attribute in the Student class should replace the advisorName. Document the Name, Advisor, and Student classes including the preconditions and postconditions where necessary. Create a test class that will instantiate a Student, fully populate all of its fields and print it out. Do not document the test class. Submit for grade Student.java, Advisor.java, and Name.java.
public class Student
private Advisor advisorName;
private Advisor phoneNumber;
public void setAdvisorName(Advisor anAdvisorName)
advisorName = anAdvisorName;
public Advisor getAdvisorName()
return advisorName;
public void setPhoneNumber(Advisor aPhoneNumber)
phoneNumber = aPhoneNumber;
public Advisor getPhoneNumber()
return phoneNumber;
public class Name
private String firstName;
private String midInit;
private String lastName;
public String getFullName()
return firstName + " " + midInit + " " + lastName;
public String getFirstName()
return firstName;
public String getMidInit()
return midInit;
public String getLastName()
return lastName;
Calculates length of the first name.
(Postcondition: getFirstName() >= 0)
@param s the length of the first name to calculate
(Precondition: length of aFirstName > 0 and <= 15)
public void setFirstName(String aFirstName)
if(aFirstName.length() < 1)
throw new IllegalArgumentException();
if(aFirstName.length() > 15)
throw new IllegalArgumentException();
firstName = aFirstName;
Calculates length of the middle initial.
(Postcondition: getMidInit() >= 0)
@param s the length of the middle initial to calculate
(Precondition: length of s > 0 and <= 1)
public void setMidInit(String aMidInit)
if(aMidInit.length() == 1)
throw new IllegalArgumentException();
midInit = aMidInit;
Calculates length of the last name.
(Postcondition: getLastName() >= 0)
@param s the length of the last name to calculate
(Precondition: length of aLastName > 0 and <= 15)
public void setLastName(String aLastName)
if(aLastName.length() < 1)
throw new IllegalArgumentException();
if(aLastName.length() > 15)
throw new IllegalArgumentException();
lastName = aLastName;
public class Advisor
private Name advisorName;
private String phoneNumber;
public String getFullName()
return advisorName + " " + phoneNumber + " ";
public Name getAdvisorName()
return advisorName;
public String getPhoneNumber()
return phoneNumber;
public void setAdvisorName(Name anAdvisorName)
advisorName = anAdvisorName;
public void setPhoneNumber(String aPhoneNumber)
phoneNumber = aPhoneNumber;
public class Test
public static void main(String[] args)
Name name1 = new Name();
name1.setFirstName("Timothy");
name1.setLastName("O'Neal");
name1.setMidInit("J.");
System.out.println("name1 = " +
name1.getFirstName() + " " +
name1.getMidInit() + " " +
name1.getLastName());
Student st = new Student();
st.setAdvisorName(name1);
Name name2 = st.getAdvisorName();
System.out.println("name2 = " +
name2.getFirstName() + " " +
name2.getMidInit() + " " +
name2.getLastName());
name2.setFirstName("Timothy");
System.out.println("name2 = " +
name2.getFirstName() + " " +
name2.getMidInit() + " " +
name2.getLastName());
System.out.println("name1 = " +
name1.getFirstName() + " " +
name1.getMidInit() + " " +
name1.getLastName());
System.out.println("name1 = " + name1.getFullName());
System.out.println("name2 = " + name2.getFullName());
}I can't get the test class to compile and i'm not sure if this is what i'm suppose to dopublic class Test
public static void main(String[] args)
Student st = new Student();
Advisor advisor = new Advisor();
st.setAdvisor(advisor);
Name name1 = new Name();
name1.setFirstName("Jake");
name1.setLastName("Schmidt");
name1.setMidInit("K.");You have the general idea, I think. You are just doing it backwards.
You create and advisor and assign it to a student. But you don't give
the advisor a name until after you assign it to the student.
You should create an advisor, give the advisor a name and then add it to the student.
//create the name
Name name1 = new Name();
name1.setFirstName("John");
name1.setLastName("Smith");
name1.setMidInit("K.");
//create the advisor
Advisor advisor = new Advisor();
advisor.setAdvisorName(name1);
//create the student
Student student = new Student();
//assign the advisor to the student
student.setAdvisor(advisor);
//now the student has an advisor named John K. Smith
//What is the name of the advisor?
String name = st.advisor.getAdvisorName().getFullName();
//I know that line looks complicated...but that's how you have created your class structure.
Instead you could have done:
Class Student{
private Advisor advisor;
public String getAdvisorName(){
return advisor.getFullName();
class Advisor{
private Name advisorName;
public getFullName(){
return advisorName.getFullName();
This way, if you wanted to know the advisor's name you would go:
String name = st.getAdvisorName();
which is much easier.
I think it would be much easier to help you if we were both in the same room, on the same computer :) -
Making a program to detect a palindrome
For my class I have to make a program that will detect whether or not a word is a palindrome. Here's what I have right now:
import java.io.*;*
*import java.util.*;
public class Tester
public static void main(String args[])
Scanner f = new Scanner(System.in);
System.out.print("Enter a word. ");
String word = f.nextLine();
char reverse=0, pali=0;
int j, r;
for(j = word.length()-1; j>=0; j--)
reverse = word.charAt(j); //To print the string backwards
for(r = 0; r <= word.length()-1; r++)
pali = word.charAt(r); //Printing the string normally
if(pali!=reverse)
System.out.println(word + " is not a palindrome.");
break;
else if(pali == reverse)
System.out.println(word + " is a palindrome.");
}So basically what I'm trying to do there is to have one loop print each character backwards and a loop inside of that print each character forwards, and inside of the second loop I check to see whether the characters are identical, and if they are not, the word isn't a palindrome. It makes sense to me, but the output looks like this, using racecar as an example:
Enter a word. racecar
racecar is a palindrome.
racecar is not a palindrome.
racecar is not a palindrome.
racecar is not a palindrome.
racecar is not a palindrome.
racecar is not a palindrome.
racecar is not a palindrome.
racecar is a palindrome.
racecar is not a palindrome.I understand why it prints that many times, because it's still iterating inside the first loop, but I have no idea how break the first loop. Also, clearly, it just doesn't work... any tips?
All help is greatly appreciated.Thanks for the reply.
I'm not sure if I got exactly what you meant, but here's how I understood it:
import java.io.*;
import java.util.*;
public class Palindrome
public static void main(String args[])
Scanner f = new Scanner(System.in);
System.out.print("Enter a word. ");
String word = f.nextLine();
boolean b = true;
char pali = 0, reverse = 0;
int j, r;
j = word.length()-1;
r = 0;
while(j!=r)
pali = word.charAt(r);
reverse = word.charAt(j);
if(pali!=reverse)
b = false;
break;
else
b = true;
r++;
j--;
if(b)
System.out.println(word + " is a palindrome.");
else
System.out.println(word + " is not a palindrome.");
}I made a mistake somewhere, because when I input a palindrome it might say that it is a palindrome(more than once for some reason), but if I input a non-palindrome it doesn't respond at all. No idea why, because I have an "else" statement that should make it do so...
So where did I go wrong? -
Making the program react to input from keyboard
Hello,-
I am trying to write a program that reacts to user input: when one hits the "y" key on keyboard the program should print out a statement or perform some other action. The following piece of code compiles, but ignores the if-part. Does anyone have any tips?
Thanks, Vahagn
import java.io.*;
public class InputPrinter {
public static void main(String[] arg) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
//works perfectly
//doesn't work:
if (line == "y")
System.out.println("Hello World!");
}Thanks, that was exactly what I needed:
import java.io.*;
public class InputPrinter {
public static void main(String[] arg) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
//works perfectly
//doesn't work: if (line == "y")
if (line.equals("y"))
System.out.println("Hello World!");
else
System.out.println(4+4);
}In the long run I AM interested in a program that processes input as it happens, without printing the input itself and without hitting the ENTER key. It was nice though to have sorted the above problem out.
Regards to all, Vahagn -
I need help in making the programe which updates our code into client machi
I need help in making the programme which updates our code into client machine from the server.
As yahoo messanger does if there is any updated version of yahoo messanger.
It asks when we login into it do you want to update new version of yahoo messanger
It automatically updates it
Need Help??Sounds to me like you need Java Web Start.
-
I need help making a program. It deals with BaseTime.
Hey. Look im having a lot of trouble with a program. It is actually a program i have to make based on another program that i was given. it is called BaseTimeTest. here is the code of that program:
import java.io.PrintStream;
public class BaseTimeTest
public static void main(String[]args)
PrintStream out = System.out;
BaseTime t0 = new BaseTime();
out.println(t0);
BaseTime t1 = new BaseTime(13,25,46);
out.println(t1);
BaseTime t2 = new BaseTime(6,0);
out.println(t2);
try
BaseTime tbad = new BaseTime(23,59,60);
out.println(tbad);
catch(IllegalArgumentException e)
System.err.println(e.getMessage());
long ctime = System.currentTimeMillis();
ctime /= 1000;
ctime %= BaseTime.SECONDS_PER_DAY;
out.println(ctime);
BaseTime t3 = new BaseTime((int)ctime);
outprintln(t3);
int h=t3.getHours()-5;
if(h<0)h+=24;
out.println(h+":"+t3.getMinutes()+":"+t3.getSeconds());
out.println(t3.getSecondsSinceMidnight());
t3.setHours(12);
t3.setMinutes(0);
t3.setSeconds(0);
out.println(t3);
t2=new BaseTime(13,25,46);
if(t1.equals(t2))
out.println(t1+"=="+t2);
else
out.println(t1+"!="+t2);
t2.setMinutes(37);
out.println(t1+"?"+t2+"=>"+t1.compareTo(t2));
out.println(t1+"diff"+t2+"=>"+t1.diff(t2));
t1=new BaseTime(3,14,25);
t2=new BaseTime(5,48,45);
out.println(t1+"plus"+t2+"=>"+t1.plus(t2));
out.println(t1+" + "+t2+"=>");
t1.add(t2);
out.println(t1);
What i have to do is create the class which this program uses to run called BaseTime. I know that the java system already has a class named baseTime() but i have to make my own. I need to make get and set methods but i am asking all of you if you can give me some ideas and maybe even code samples. The help would be greatly appreicated. i'll reply to what you say but it maynot be right away as i am very busy.I need a setHours method, a setMinutes method, a
setSeconds method, a getHours method, a getMinutes
method, a getSeconds method, java.util.Calendar effectively has all these.
a setSecondsSinceMidnight method, and a getSecondsSinceMidnight method. Not hard to come up with.
I also need multiple BaseTime methods because i need to have
overloaded methods because each method has to take in
different arguments. One takes in no arguments, one
takes in one argument, one takes in two arguments and
one takes in three arguments. And what are these methods doing?
I also need methods that convert milliseconds to seconds, one that
converts minutes to seconds and one that converts
hours to seconds. This is all pretty simple. I would extend GregorianCalendar or wrap a GregorianCalendar. Most of what you need is already there, and all you need to do is add the few other methods.
getSecondsSinceMidnight - make a calendar representing midnight, get the milliseconds value for both, subtract, convert to seconds.
setSecondsSinceMidnight - I would try setLenient(false), set the calendar to midnight, and then just set the seconds field. Might work.
Conversion - simple arithmetic.
Other methods - you didn't mention what they do. -
Making a program "sit and wait"
I've written a program that drops an icon in the system tray and just waits around for the user to do something with it. When I first wrote the program, it would add the icon to the tray, then immediately exit since there weren't any active threads. I remedied the situation by starting a thread that consists solely of:
while (true) {
Thread.sleep(9999999);
}This does what I want it to, but it seems like there should be a better way of preventing the JVM from exiting automatically. Any ideas?I just have an ActionListener strapped to the icon...
the user clicks it, and an ActionEvent is fired off.
No additional thread needed as far as I know.Then you have (I suppose) a Swing framework app, which creates threads behind the scenes. Not a Swing developer myself, but normally one creates normal Swing apps with a visible form, and that doesn't terminate until you close the form. If you're creating a "Windows tray icon" thingy, (which of course would only work on Windows), sounds like for one thing you're using the wrong tool for the job (java is for platform independence, not for Windows-specific apps). But if you want to continue down this road, you should research how Swing creates its threads, and maybe you can "tell" it to make the thread that it is creating a non-daemon thread (or if it creates non-daemon threads, tell it to create a daemon thread instead - I don't remember which type does what). -
I'm taking a Java programming class that is required for my major, and I am very illiterate when it comes to programming. How difficult is it to make a program that converts miles per hour into kilometers per hour?
I'm taking a Java programming class that is required
for my major, and I am very illiterate when it comes
to programming. How difficult is it to make a
program that converts miles per hour into kilometers
per hour?Difficult is a bit of a subjective term. Not too hard I would say. -
Making a program that depends on another program
What would I have to do to make a simple program to lets say just type in the phrase "Hello" into another program such as for instance an AOL IM or into a game chat? If anyone could help me that would be great. Thanks.
Sounds like what you're doing will require native code.
One program can execute another with Runtime.exec(), or communicate with another using sockets, but you can't just randomly type text into other programs from your Java application.
Maybe you are looking for
-
How To user jstl in jsp 1.2?
hai all, i can use jstl for each tag in jsp2.0 but i want to use it with weblogic 8.1 and it support servlet 2.3 and jsp 1.2 only. can any body show me how to use forEach tag in jsp 1.2. thanks in advance, Rahul
-
Nomad Explorer not detecting Nomad Jukebox Zen Xtra after firmware upgr
<blockquote dir="ltr">From the firmware thread: "The Creative drivers shouldn't make any difference. An MTP device is looking for the Windows Media Player 0 MTP driver (which is installed with WMP0)."[/quote]Is that why my updated Zen Xtras (40G and
-
How do i transfer photos from ipad to pc running vista
how do i transfer photos from ipad to pc running vista
-
Location of stubs, skeletons, remote interface ,client and server files
I have a question to the subject mentioned above : In a training example for RMI I red the following : .... stubs, remote interface and client files into client location ... skeletons, remote interfaces, server files and stubs into server location ..
-
Suppressing ORA-1403 in Forms 6i
We are running FORMS 6i and I am creating a library function that will do various types of lookups and then behave in specific ways based on passed parameters. How can I over-ride the default ORA-1403 when no records are found in the query? Thanks