308 byte By
atamela at 2007-9-30 1:25:25
Hi,I have a JAR file and I have another java file (call it myFile.java) that wants to use some of the classes in the JAR file. I'm wondering if this is possible. If so, how do I compile myFile.java and how do I run it? I assume I need to set the classpath to include the JAR ...
I Have an assignment to change an if statement to a switch statement to this statement belowif (a == 1)x += 5;else if ( a == 2)x += 10;else if ( a == 3) x += 16;else if ( a == 4) x += 34;elsex += 40;I am confused, first off I dont know what the controlling expression is. I do know that a switch ...
Hi,I'm writing a chess game applet which will be played between to players over the internet. I'm currently working on the applet side at the moment and will develop the server side once I have completed the applet. I'm currently having problems displaying the actual chess pieces on the ...
I am a newby and learning how to program in java. I read a bit about java and started simple programming, but I do not understand what this few syntax are used for and their proper purpose in a java program. 1) public2) void3) static, etc. THe book didn't really explain their purposes so I ...
Hi, folks. here is my mystery: as you can see from the code snippet below, both the freeBusyFlag() and getBusyFlagOwner() methods are synchronized. So, 1. does the thread hang at the getBusyFlagOwner() while waiting for the freeBusyFlag() method to free the object block? 2. If not, and the ...
Hi,I am new t Java and I am writing some code to inrder todo these:1st I try to write data that is entered in Textfields in various Frames by pressing a button. I have tried this void jButton3_actionPerformed(ActionEvent e) throws IOException {FileOutputStream fos = new ...
102 byte By
hyee1a at 2007-9-30 1:26:06
Is it better to define variables all at the top or within your code when you need the variable?
3835 byte By
xytora at 2007-9-30 1:26:11
i already have the structure set for adding rooms, and walking, and commands, but i still need to know how to make a character class that stores items (that are also inside the rooms), and an enemy class (enemies are also found within the display info of the class, and can attack.here is my ...
Hi,can someone help me with importing? I am trying to use Digester for parsing through my XML document. I have the jar file, which is namedcommons-digester.jarWhen I look through it, I see an "org" folder, then inside that I see an "apache" folder, inside that I see a "commons" folder, inside ...
Basic question - can java be integrated with php? I know java and C++ can work together, but I don't know about scripting languages... and is there a place I could find good info on how to make them work together? thanks.
241 byte By
xytora at 2007-9-30 1:26:54
how do i make an independent executable file from the compiled .java and .class files?if i cant do that, then is there a way of making the exact thing appear as an applet, without using any paint methods, or anything like that?
I want to send/receive data through the serial port. what articles/topics should i read ?I would also appreciate it if anyone could share me articles/topics to read to understand how to processSMS (cellular phone text messages) data.
Hello again world.I think I have achieved a "light bulb" moment and I'm asking for anyone to either confirm it or shoot me down. I'm just getting into GUI stuff. I have a two line main method that simply instantiates a MyFrame object and then displays the frame.Here is a piece of the MyFrame ...
Can I declare and use variable names dynamically? I know you can't use $ like you can in perl, but I'd like to do something like:for (i = 1; i < 65; i++) {for (j = 1; j < 9; j++) {JTextField part$i_seg$j = new JTextField("0", 5);}}Then assign the values of the text fields to an ...
595 byte By
yeshmana at 2007-9-30 1:27:08
Well this is my first applet, so this might be a easy question to answer. When I create a html file and add in an applet, i get a big gray box and the error class war not found. I have the classes and the html file in the same directory. Here's my code so far:<applet code="warprogram.class" ...
is the javax.comm class for free? i.e., does it come with the j2sdk 1.4.1 download?
Subject is the question
Hello all,Hope everyone is having a great day.I wanted to get some inputs on some free installer utilities that can be used to painlessly install Java projects on Windows/Linux boxes. What would be something I should use? Any help will be most appreciated. ...
Hey,I took screen shot of my whole screen and using locationonscreen i can get where the application i interested in locate at. but the problem is the image i took from the screen shot is need to be rescaled so the coordinate pointinside that image will be different than the location onscreen ...
488 byte By
coach-xa at 2007-9-30 1:27:40
I have searched the forums and cannot find the exact answer I am looking for so here goes. SimpleDateFormat sdf = new SimpleDateFormat("M/d/y");String strDate = "02/25/04";Date myDate = sdf.parse(strDate);gives me : Wed Feb 25 00:00:00 EST 2004but I need the output of myDate to stay 02/25/04 in ...
116 byte By
@nuraga at 2007-9-30 1:27:46
Can someone point me to any good document (or White paper) on estimating efforts in a java project.-a.
96 byte By
rtrama at 2007-9-30 1:28:35
Is it possible to store a JAVA_OBJECT in a database that does not support this data type?
How would you go about to have a wildcard instead of the "*" in the following filefilter; File[] files = new File("./resultat/resultat_" + "*" + "_" + index[0]).listFiles (new FileFilter () {public boolean accept (File file) {return ! file.isDirectory ();} });All help appriciated- Karl ...
228 byte By
correroa at 2007-9-30 1:28:46
How do I dynamically access the value of a variable by a name from another variable?For example:String var = "myvar";I wish to get the value of a variable named "myvar". How do I get it?Thanks!
hi there .... how to install this package .. can't find any documentation, if there was , maybe i've skipped the page ...
I can't figure out what I should use to terminate my quick-hull method that uses divide and conquer. Must stop the recurrsion but everything I have tried has still given me a stack overflow error. If you need more info I will be checking back every couple of minutes.If any one would take the ...
158 byte By
new2003a at 2007-9-30 1:30:03
Hi!When should I write like this: checkbox.getModel().isSelected();and when should I write like this:checkbox.isSelected();
I am trying to convert a string to a long, but it is failing on me. Below is a code snippet:String timeStr = "1.0765902707E9";long time = Long.parseLong(timeStr);System.out.println("Time: " + time);I'd appreciate any help you can provide on this problem. ...
HiI have an array of strings(names) and i want to sort them alphabetically . I dont have clue how to do this and ive searched the API's etc to find out if there are already classes that i can import but i cant find any. Please help,Many Thanks
Hi all, Been a busy bee learning java in the past few weeks and I have a few basic (yet varied) questions....When declaring Strings, what is the difference between: -String myString1 = "This is a String";and String myString2 = new String("This is also a String");When writing to a outputstream ...
Hi,I am trying to represent java byte code instructions as subclasses of another class called instruction.the four things that I am asked to do are:+ decide on fields each class require to store operands+ complete the constructor+ implement toString() method for the class+ set visibility of the ...
I've been having problems running applets, even ones I didn't write, that I know already work due to being from the web etc. They compile fine and my references in the html files I've double checked etc. So I have the class file and the html files all set up ok but they still don't seen to ...
I know this isn't the best place for this post. But I don't know where else to turn.I've recently installed Tomcat 5.0..... It ran great BUT I can't seem to shut the D$%$^#M thing down now. I need to restart the Application server but Shutdown doesn't do anything. According to the win2K ...
dear friendsplease tell me if we can overload methods , why can't we overload operators aswe do in c++.Please reply , as I have to submit my questions to my teacherthanks.
HiIve been creating a program to hold Strings (String intial, String name, String number) by putting them into Person[ ] entry. Now i have methods like getName,getNumber,getInitial etc and i want to sort this array Person[ ] entry to print out the array in alphebetical order and i have no idea ...
Hi everybody!I'd like to confirm if it's possible to replace the programs developed in Visual Basic.NET by Java? Including local file access, Databases, ODBC, GUI etc.In other words, to develop traditional MS Client-Server application to run standalone in a
682 byte By
tancooka at 2007-9-30 1:31:20
Hi,I need to pass an array of randomly generated numbers to a method that takes an Object. I can't seem to figure out how to do this...Here is my code for creating the array of random numbers:Random generator = new Random();for (int i = 0; i < size; i++) a[ i ] = ...
953 byte By
jgowdera at 2007-9-30 1:31:40
I am trying to connect to DB2 Database, which is sucessfully configured to DB2 database in the data sources in IBM WebSphere 5. When I try to run the following code, I get "javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory [Root ...
125 byte By
Opyusea at 2007-9-30 1:31:41
I know the array.length method gives you the length of your array but what gives you the number of values it contains?
Hi,I'm new to java, and managed to get a policy file which allows access to write to a file on the server using the command:appletviewer -J-Djava.security.policy=mypolicy http://mywebsite/My question is, how can I provide the same read/write permissions for the applet when viewed in IE?Thanks ...
Hello again world.I have a class called "MyFrame" which is declared public class MyFrame extends JFrame implements ActionListener {which then goes on to set up the JFrame and add listeners to some JButtons.Then, I code the actionPerformed() method of the ActionListener interface public void ...
A have a program that asks a user to enter a song length in minutes.a 90 second song would need to be entered as 1.30, but this is wrong as it should be 1.50.Does anyone have any idea how to perform this conversion?
469 byte By
edecaa at 2007-9-30 1:32:05
I have the following regular expression:\\([0-9]+[-\\+\\*/][0-9]+\\)It will match anything like (8+9) or (15*30), the double \\ is because I'm storing it in a String. However, my input string might be:((8+9)+6) or ((8+9)+(6-4))It will always be in parenthesis as above, though. How can I extend ...
I was hoping someone could tell me if Java had a built-in function to prompt the user for input, similar to:"cin >>" in C++,and"scanf(..." in ANSI C.Thanks.
393 byte By
sgk_17a at 2007-9-30 1:32:15
I'm trying to check to see if a file exists and if not, go somewhere else and get it and copy it over. The subdirectory may or may not exist also. How can I check to see if the subdirectory exists, and if it does, check to see if the file exists? I thought about using a URL object and trying ...
351 byte By
ike2010a at 2007-9-30 1:32:19
Hello. I wrote a basic java app that deletes my temporary internet files, history, cookies, etc. I would like to place a toolbar (or just a button) in Internet Explorer 6 that will run the program.I'm not really sure where to start looking on how to accomplish this. Does anyone know how to do ...
How can I get TexArea to display whatever I chose from a choicebox?Here's what I have so far:import java.awt.*;import java.applet.*;import java.awt.event.*;import java.awt.TextArea.*;public class FruitCocktail extends Applet implements ItemListener{Choice fruitChoice;TextArea textArea;public ...
67 byte By
rtrama at 2007-9-30 1:32:34
What databases support JAVA_OBJECT and where can I get them?
For a class project we need to convert a single upper case character to a lower case character using the following method declaration:public static char upperCaseToLowerCase(char ch)But I cannot get it to convert. Can this be indicated in the method in this form?Character is to be entered from ...
259 byte By
TomVdHa at 2007-9-30 1:32:44
hellow all is it possible to get a specific cell (row, colomn intersection) ;-) from your spreadsheet into a java application and then browsing in the sheet so that u can get other cells in your application through pushing a buttonthx in advance