How To Make Jar File Compatible For All Window Machines
May 5, 2014
I made the program below in java and compiled with javac command in Window7 (64bit machine). It simply post my machine IP and Mac address to my server application.
When i run this script with java as >java Macregister
I get what is expected, the program runs well on my machine.
When I try to run it on other machines (Win8 - 32 Bit) I get error message and nothing works.
My problem is 1) to make it compatible for all machines 2) to convert it into JAR application so that it is self executable on different machines.
I am a new to Java and am struct,
import java.net.*;
import java.io.*;
public class Macregister{
public static void main(String[] args) throws Exception {
InetAddress add=InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(add);
byte[] mac = network.getHardwareAddress();
StringBuilder sb = new StringBuilder();
[Code]...
View Replies
ADVERTISEMENT
Apr 21, 2015
I have the following problem:I have 4 components in my GUI that goes like this in the CENTER of the BORDERLAYOUT:
1. JLabel
2. JTextArea
3. Jlabel
4. JTextArea
Everytime i make the GUI window bigger, all these elements spread out. How can i get these elements to have a BREAK line (i.e. a break line after 1. Jlabel) so that no matter how i stretch the window, it will stay in-tact and the other elements will follow underneath.
View Replies
View Related
Oct 2, 2014
My goal is to make 2 rectangles in the same window. so far I have this.
import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
public class BoxComponent extends JComponent
[Code] ....
After running the program I get one rectangle, the red one. If I take the code out for the red rectangle, I only get 1 blue one. What am I missing?
View Replies
View Related
Jun 17, 2014
I would like to learn how to add an image background to a window in java that I can put controls like buttons, textboxes, and checkboxes in front of. I already tried using a JLabel with an ImageIcon but I cannot overlay controls over the JLabel. From what I understand there are multiple ways to do this. What is the best way and how can I do it?
View Replies
View Related
Aug 30, 2014
I set these up, but the command console comes up, I don't see the "Hello World" in the window and it closes.
How can I get the output "Hello World!" to appear in a "cmd" window and stay there till i close it?
View Replies
View Related
Feb 12, 2014
I am trying to learn Java and while i was playing a bit with the basic knowledge that i have i encountered a problem. When i run the program, the lines and the picture appear in two separate windows when i compile the program. how can i make them appear in the same? The code is this:
public class Game
{
private int x;
private Picture pic;
[Code].....
View Replies
View Related
Nov 28, 2014
I am trying to run a Java applet (.jnlp) file through OSX. The purpose of the applet is to upload files to an SQL server. When I try to run the applet, I get an "Unable to launch the application" error because "No application resources are specified for this platform" After some digging , we noticed there are only resource instructions for "Windows".
Would there be any way possible to make this compatible in an OSX environment through a few alterations to the code, or would this be an issue that the original developers would have to resolve?
Here is the specific code pointing to the Windows Resources:
<resources os="Windows" arch="amd64">
<j2se version='1.6+' initial-heap-size="64m" max-heap-size="512m"/>
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/uploader.jar' main='true' />
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/lib/jnlp.jar' download="eager" />
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/lib/transform.jar' download="eager" />
[Code] ....
View Replies
View Related
Feb 12, 2014
I am using AES/CBC/PKCS5Padding algorithm to encrypt/decrypt, it works fine across machines, since i am not using a Facrtory to create the secret . I am using constant SecretKeySpec and iv for the ciphers. This of course heart the security , and doesn't prevent the "man of the middle" problem .
I saw that there are ways with key generation with MAC , and RSA symmetric encryption , but i am not sure how to implement it , and how to it depends on local certificates or files .
View Replies
View Related
Apr 7, 2014
I am trying to upload the text file in specific location in my disk but when I open selection window it displays all type of files while it should display the files only having .txt extensions
I am writing the code below,
<%@page import="org.apache.commons.fileupload.*,java.util.*,java.io.*"%>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<%
// JSP to handle uploading
// Create a new file upload handler
[code]....
View Replies
View Related
Apr 6, 2015
I am new to javafx I start using it instead of swing i used the scene builder for my forms the problem i faced i don't know how to have main screen with menu bar at top and depending the select from the menu it will open other windows and those window must be inside my window just like for example netbeans.
I don't need to open new window in separate i need all windows inside my main window and controlling over them minimize maximize perhaps.
View Replies
View Related
Apr 16, 2015
I am currently in the progress of making a GUI for a project. I am trying to make a maze and I need it displayed in a GUI. So, I thought I would be able to do that with a text file that I created. The code I have for it so far runs and compiles but it is not displaying my text file as a GUI, even though it reads the file. All I get are a bunch of green rectangles. I am using Netbeans to code this
package rectangles;
import java.awt.Color;
import java.awt.Graphics;//this will draw the maze
import java.awt.Graphics2D;//
import java.io.BufferedReader;
import java.io.FileNotFoundException;//handles file
[code]....
View Replies
View Related
Mar 15, 2015
I have a program that reads lines of text, but some of the lines of text aren't applicable and break the program. I'd like to put a letter in front of the lines in the .txt file I want to use, such as a #.
I need to make an if loop that'll check for the first letter on the line being #, and use the line in the program if true and skip if false. I'm guessing a boolean variable would be useful here to be true or false depending on the presence of #, but I don't know how to only read the first letter of each line, how can I do this?
View Replies
View Related
May 10, 2014
I am suppose to submit my project as a WAR file but not sure how to do it.
View Replies
View Related
Jan 2, 2015
would like to make .jar application, which will be able to sava data without using any database (Postgres...) but i dont know, what type of datastorage i should use to make the application portable. I just want to .jar file, which is capable works on any computer with java installed. Is there some option?
View Replies
View Related
Feb 8, 2015
I'm trying to make the program read the "Entity.sql" File and then execute it to make it run in phpmyadmin. I did used a mysql connector to link netbeans to mysql and then it should used the Connection for phpmyadmin to execute the Statement (Entity.sql).The Entity.sql file contains as sql Statement:
CREATE DATABASE IF NOT EXISTS Student
The problem is that it's not working and it's giving me this error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
here is my entire code:
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.*;
import java.io.*;
import java.util.*;
[code]....
I want the program to first
1- Read the Entity.sql file
2- Execute the file into phpmyadmin
View Replies
View Related
Feb 1, 2014
My assignment is to make GUI to calculate orders and to save the calculation to .csv file.I have solved "save" button and it really does save my input to .csv file.But, my problem is "Load button" When I press it, how to load .csv file to my existing JTextFields?
View Replies
View Related
Apr 23, 2015
I am trying to make a Library that will read some Input Files from a File . Like When We Enter Nuber from a System.in
1
2
45
667
77
34
and then store these values in int[] array
What I want is I Save all these values in a File and at Run time pass path of that file to command line arguments and then int[] array will be initialize using that
something like this [URL]
View Replies
View Related
Feb 8, 2015
I'm trying to make the program read the "Entity.sql" File and then execute it to make it run in phpmyadmin. I did used a mysql connector to link netbeans to mysql and then it should used the Connection for phpmyadmin to execute the Statement (Entity.sql)..The Entity.sql file contains as sql Statement:CREATE DATABASE IF NOT EXISTS Student
The problem is that it's not working and it's giving me this error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
here is my entire code:
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.*;
import java.io.*;
import java.util.*;
[code]....
I want the program to first
1- Read the Entity.sql file
2- Execute the file into phpmyadmin
View Replies
View Related
Nov 13, 2014
i can't make the [JfileChooser] save text file instead of opening files.that [ComboBox] always don't show me the items that i have inserted in eclipse.
View Replies
View Related
Feb 18, 2015
How do I make the file reader object move to the next line if there is no more input on the line. Here is my text and output file as you can see that my text file column cuts off on the 2nd line after 70. I want to read that next line which is 100 into my labs variable however its reading it into my final exams variable. I'll also post the code but I didn't think it was necessary.
textfile:
100908095
1008070
10070
output:
Labs Projects Tests Final Exams
100908095
1008070100
70
[import java.util.Scanner;
import java.io.*;
public class MyGrades
{
public static void main (String[] args) throws IOException
{
int lab, project, test;
int finalExam;//Par and Player values
[Code]...
not sure if I code wrapped it correctly
View Replies
View Related
May 8, 2014
We are making a tic tac toe game for my CS120 class and I am having trouble figuring out how to make our X's and O's. Is there a way to make shapes besides making two lines for an X and an oval with a white smaller oval inside to make an O? We have only learned the basics so far in class (i.e. events, inheritance, client-supplier, etc.)
These are our instructions:
Write a controller that controls the game. There is one human player (the X player) and the computer player (the O player). The name of the class must be TicTacToeController. In a sense, the controller is the game since the controller will 1) create a TicTacToeModel 2) create a TicTacToeView and 3) create a TicTacToeButton (you must write this class following the design pattern covered in class lectures), a label, and text field such that when the button is pushed, the player moves into the cell selected by the text field. After every player move, the computer moves into a randomly selected empty cell. When the game is over, a text message must be displayed somewhere on the screen the gives the status of the game. While you are free to change the appearance of the controller, the basic elements must be provided (a view of the game, a button, and a text field to enter the cell). A sample screenshot is displayed below.And this is the code i have thus far:
[import java.awt.*;
import javax.swing.JFrame;
public class TicTacToeView extends Rectangle
public TicTacToeView(int x, int y, int w, int h) {
super(50,60,w,h);
this.setBackground(Color.red);
JFrame win = new JFrame("Tic Tac Toe");
win.setBounds(10,10,w+100, h+100);
win.setLayout(null);
win.setVisible(true);
win.setBackground(Color.gray);
[code]....
View Replies
View Related
Feb 5, 2014
Is it possible to display an AWT Window only(just 'cause feel like doing it)? Or, is the simplest window possible to display a JFrame?
View Replies
View Related
May 8, 2014
I am writing a small app to automate some actions on my computer this requires me to open an application and click on a button I am using
Process child0 = Runtime.getRuntime().exec("/home/user/application");
to do this. The problem is every time it opens at a different lcation on the screen so i cannot click on it using the robot class due to x,y coordinates being different every time. with selenium you can use .setlocation(x,y) method but how can this be done for other applications.
View Replies
View Related
Apr 19, 2015
I have an assignment to create a circle with a radius of 40px in a 100px by 100px window and move the circle with the arrow keys.The circle can't move past the the edges of the window. I believe I have the code right but the window won't create the window or pane with a width of 100 px because of the close, minimize, maximize buttons. Is there a way to remove those or force JavaFX to create it with a width of 100px? Here's what I've got so far.
package movecircle;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
[code]....
View Replies
View Related
Oct 9, 2014
How would i go about making this NOT resizable?
If I do try to do ChatFrame.setResizable(false); it gives me this error:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Cannot make a static reference to the non-static method setResizable(boolean) from the type Frame
at com.ui.ChatFrame.<init>(ChatFrame.java:37)
at com.ui.ChatFrame$5.run(ChatFrame.java:403)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
[Code] ....
Here is the code:
package com.ui;
import com.socket.History;
import com.socket.Message;
import com.socket.SocketClient;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
[Code] ....
View Replies
View Related
May 20, 2014
I have a WindowClosing(WindowEvent e) method, but when I close my window it isn't doing anything inside the method. I am making a launcher and I want to make it so when the actual game window is closed it makes the launcher window visible again.
Java Code: public void windowClosing(WindowEvent e) {
this.jf.setVisible(true);
} mh_sh_highlight_all('java');
View Replies
View Related