How To Make Portable JAR File With Some Kind Of Database Storage
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?
My friends and me are trying to make online Test taking system. We got a very basic doubt.
We have developed classes and relationship between classes for example : Online Test Taking system will have admin and student class. And Admin will have list of students.. etc.
But question troubled me was: if we use database to store all data for example student details then I can perform all sorts of operations writing sql query and store result in some other database then what is the need of "ArrayList<Student> field in Admin".??
Question is: We can put everything in database and manipulate using database(sql) functions to manipulate it.Then what is the need of Arraylist of anything which is just used to store object details for example student details....??
The challenge is to weed out all the prime numbers without using any kind of division (%, /). My code doesn't weed out certain numbers, such as many multiples of 5, the number 49, etc, and I am not sure why. Here is my code.
My logic for the for loops was this: Starting with the upper numbers of the ArrayList, find every number that is a multiple of that number and remove it from the ArrayList. Every time you find a multiple, increase the variable multiply, so the program knows what the next multiple to look for.
// program doesn't work yet. import java.util.ArrayList; // import java.util.ListIterator;
public class Sieve2 { public static void main(String[] args) { int upperLimit = 55; ArrayList<Integer> primes = new ArrayList<Integer>();
I would like to make a database using HTML and Java. I already made something like this using swing. I am just looking for some pointers here. I just started looking into Java Play 2 and I have a feeling this is what I am looking for. JavaEE is very complicated and I have read that it is being phased out. What is your opinion on this?
I want to make a static HTML page and put it on my home network and treat one of my computers as the sever accessing mySQL.
I am trying to write a specific byte sequence to a specific memory location on a removable storage drive. Does Java allow me a way to do this? I know the dangers in accessing memory, but the memory location of the data that will be written will never change.
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
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?
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();
I want to retrieve file from database which is stored with blob datatype and i am passing manually id associated with in code. Its not retrieving the file.
public class retrieve_image extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ResultSet rs = null;
I am having a problem to connect my .exe file to the database(mysql). I used launch4j to convert the jar file to .exe but the jar file can connect to the database when running inside the dist folder. When I run the .exe I am getting this error: No suitable driver found for jdbc:mysql.
I need to read in a file then create the tables and load in the data from the files to the database. I cant seem to figure out how to load the provided text file into the database.it contains lines like this
Boston Americans,AL,Pittsburgh Pirates New York Giants,NL,Philadelphia Athletics etc..
The first line in the field is the name of the team that won in 1903, and the last line is the name of the team that won in 2013. Note that the World Series was not played in 1904 or 1994, so those years are skipped in the file
The program should have a menu that has the following options.
NOTE: the data for choices to e) needs to come from running sql statements on the database tables created in choice a). Not from an ArrayList in memory.
a) Convert the baseball text file to a database table. Ask the user from a dialog box, for the location of the text file. This menu item should create the tables and load up the data.
b)Let the user input a team name, and list all of the years that they won the World Series
c)Let the user input a team name, and list the number of times they won the World Series
d)Let the user input a year, and you list the winner and loser for that year.
e)Add a new winner. The user should supply the winning team name, losing team name and year. Make certain that the year does not yet exist in the table and do not duplicate the team name(s) if they are already in the database tables.
f)Exit
I have two tables teams and games:
Drop table if exists game; Drop table if exists team; CREATE TABLE IF NOT EXISTS game ( yearGame int(11) NOT NULL, winTeam int(11) NOT NULL, lossTeam int(11) NOT NULL,
[Code] ....
I cant figure out how to load the values into the tables as only some of the fields are in the text and and the league field is in a seperate table. Here is my script so far
do { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Text/Java files", "txt", "java"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(null);
We have a custom authorization in our application login page, authorization by using eToken and java (signed jar classes) and applet as login button on page. It's work fine on older and current java versions like 7u67, 7u71 but it's not work on new java version 8u25.
We write a test class named AuthControl without package, we found that problem is in .jar file path, for example:
&APPLET_VERSION. is a jar file name, uploaded using "Shared Components / Static Files - Create"
<script src="https://www.java.com/js/deployJava.js"></script> <script> var attributes = {code:'AuthControl', archive:'#WORKSPACE_IMAGES#&APPLET_VERSION.', width:132, height:37}; // problem in the path to the .jar file var parameters = { scriptable:true, mode:'login' }; var version = '1.6'; deployJava.runApplet(attributes, parameters, version); </script>
Error is: ... java.lang.ClassNotFoundException: AuthControl at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) basic: load: class AuthControl not found. ...
But if we use a direct path to the jar file, it's work fine without errors, example:
<script src="https://www.java.com/js/deployJava.js"></script> <script> var attributes = {code:'AuthControl', archive:'http://example.com/myapplet.jar', width:132, height:37}; var parameters = { scriptable:true, mode:'login' }; var version = '1.6'; deployJava.runApplet(attributes, parameters, version); </script>
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
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?
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
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
I'm given a task to generate an API (a jar file) where the access of a certain database is provided through the API. basic functionality: Client sends a query through the API to server and the Server responds with data.Since its and API, do I have to implement the code or is it enough if i gave just interfaces? what are the OOP concepts to focus on when designing a good API.
I'm using jsf 2 to upload file, first I upload the file in a system directory, then trying to store the path to database with other information, my stuck is that when submitting I upload the file successfully, find it in the right place, find the other information such as description, file name ... in database but don't find the path. this is my managed bean :
I have written my whole java code in netbeans IDE and create database in MYSQL work bench and connected java Gui with this DBMS through requried driver.when i run this program from Netbeans IDE , my program successfully access the data from DBMS. But when i created this java gui exe file its not working and not accessing data from DBMS, and each times gives exception "Driver not found ".if there is no driver loaded in this program how this file is working when i run this file from netbeans .
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.
I am creating an application in core java where i am using database. I need to create a database configuration file & include it all other files. So, how can i do that ?
Java Code:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:MYDSN","system","tiger"); mh_sh_highlight_all('java');
I cannot do this in an interface since only abstract methods exist there. I tried to create an another class file to extend it but my program is already extending other class i.e. javax.swing.JFrame..How can i implement this ? just by creating the object of that class in main method ?