Marco Galea

Ranch Hand
+ Follow
since Mar 30, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Marco Galea

Kemal Sokolovic wrote:You can create a batch file (under Windows) or a shell script (*nix) that you can use to run your console application. E.g., for Windows:

Save it under a name with .bat extension, and you'll have the desired result - double click on this file will run your application.



Worked Great Thank you very much
12 years ago
Hi to all,

I exported my project into a .jar using eclipse. The problem or question I have is, if it is possible to make my program (which runs on the cmd) by just double clicking on the jar file. Cause at the moment i have to run it by opening the cmd myself, go the directory of the jar and input "java -jar myproj.jar"

Thanks in advance
12 years ago

Paul Clapham wrote:

The API Documentation wrote:The GridLayout class is a layout manager that lays out a container's components in a rectangular grid. The container is divided into equal-sized rectangles, and one component is placed in each rectangle.



Cheers...so i definately understood it correctly.......

Thanks
12 years ago
Hi,
I was wondering if it is possible to specify the exact grid height (or else something as setSize()) when using a GridLayout ??
I manage to put components in a GridLayout so as to keep my preferred sizes by first putting them in a JPanel and then in a gridLayout panel, but still the problem is that between a component from a grid to the other, the height is not my liking...... so i was wondering if i could actually change the size of a grid.

I know i could use gridbaglayout but want to see if possible with this layout.

Thanks
12 years ago

mike statham wrote:Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at Grades.main(Grades.java:26)

Is what I get after applying the suggestion todo the the following
int[] numGrade = new int[20];



Hi there first of all in your for loop you should write :


since the array has 20 elements and starts storing elements from 0 to 19

secondly the letterGrade[] you specified that it has 2 elements in line 10 when in reality it should i suppose have 20 aswell since it's using the same variable 'i' !!
13 years ago
you haven't declared "key" anywhere in your code that's why it's throwing that error. If you want to read the nextDouble you should use the reference you created for the Scanner object i.e. "scan"



also i don't actually get the use of the do-while in the first place. i think you could have done for example



but you'll still will have a problem cause you need to advance the scanner to the next new line and calculate the average for each "person" and print
13 years ago
hi there i had kind of the same problem when i was doing my assignment and it seems that what Jesper is saying is right. I used to BufferedReader instead of the Scanner class and the problem was solved...
e.g :


hope this helps.
13 years ago
RXTX library installed and working.
Thanks
13 years ago
Thanks Jesper,
i actually read somewhere that they stopped to support it but just wanted a second opinion to be honest.... will download Rxtx and try to install it... if i bump somewhere during the install will post here since it's the first time installing a "3rd party" library.

Thanks again

Marco
13 years ago
Hi guys,

I'm trying to import the javax.comm library but it seems that i don't have the package (so i'm assuming it doesn't come part of the JDK download). anyway does anyone know a link for this library please since google didn't really help me this time around ? Also i've heard another library RXTX, which lets you connect to a serial port (what i would like to eventually do), the thing is once you download how to install ??? or just paste the jar into the java folder ??

If anyone knows of another library which one could use to connect to a serial port please let me know.

Thanks in advance
13 years ago
Hi Jeff,
yes i did include the \r\n but still i didn't get anything, but the way you explained it makes sense about sending a request. I don't want to do anything specific, i just want to play with the code to see what's happening and which piece of code is doing what, after all im still a beginner and i suppose it's all part of the fun and learning......

Thanks again and are the classes called HttpXyz so as to read about them ?

btw yes, the client and server are the same platform.

Tim Moores wrote:Just a guess: Don't println to a Socket. It applies to readLine as well.



Thanks Tim it was a very interesting read.
If i understood properly the article says we should not use println but just print.... but the article also says that's it's a common practice in Mac.

I tried to change every println to print only but still have no output. could it be because i'm running on windows ??

Thanks again and have a good night
Hi all, i'm very very new to networking and was wondering if it's possible using this code to "listen" or get some data of what's happening using this code..... when i compile and run nothing is outputted (im using port 80 since it's http so i suppose browsing). Thanks for any info....

Rob Spoor wrote:It is from Java 7 on:
If you're using Java 6 or an even older version you have no choice but to use two distinct catch statements.

However, you shouldn't need to catch NullPointerException at all. You should instead prevent it by adding the necessary checks.



Thanks for your reply !!! i suppose i can use also the & operator instead of | ?? as for the null exception... they were the first two exceptions that came to my mind but alas its good to know that its not good practice to catch them.
Regards
13 years ago
managed to have a successfull Export/Import by putting everything into an array and thanks to your help.....
Regarding the exceptions, is it possible to catch 2 exceptions within a single catch ??? cause at the moment i have to do 2 seperate catches.

for example :

13 years ago