Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Please help me (Data mining Program)

Anthony_ReaperMay 25 2015 — edited May 27 2015

Hey guys I am needing to create a data mining program in Java code. I am using NetBeans and created a JavaFX application. I need this program to read a file, analyze the data (calculate percentages based on total sales of each group to overall sales of company, and add an organizational value code to each group), then write this information to a new file. So far I have been able to code to find the file and open it but I cannot figure out how to do the analysis portion. Could you please help me figure this out. I have attached the code I have come up with so far.

 

package businesssalesdataanalysis;

 

 

import javafx.application.Application;

 

import javafx.event.ActionEvent;

 

import javafx.event.EventHandler;

 

import javafx.geometry.Insets;

 

import javafx.scene.Scene;

 

import javafx.scene.control.Button;

 

import javafx.scene.layout.Pane;

 

import javafx.scene.layout.GridPane;

 

import javafx.scene.layout.VBox;

 

import javafx.stage.Stage;

 

import javafx.stage.FileChooser;

 

import java.awt.Desktop;

 

import java.io.File;

 

import java.io.IOException;

 

import java.util.logging.Level;

 

import java.util.logging.Logger;

 

 

 

/**

 

*

 

* @author Anthony

 

*/

 

public final class BusinessSalesDataAnalysis extends Application {

 

      

 

    private final Desktop desktop = Desktop.getDesktop();

 

   

 

    @Override

 

    public void start(final Stage primaryStage) {

 

        primaryStage.setTitle("Business Sales Data Analysis");

 

       

 

        final FileChooser fileChooser = new FileChooser();

 

       

 

        final Button uploadButton = new Button("Upload a file");

 

       

 

        uploadButton.setOnAction(

 

                new EventHandler<ActionEvent>(){

 

                    @Override

 

                    public void handle(final ActionEvent e){

 

                        configureFileChooser(fileChooser);

 

                        File file = fileChooser.showOpenDialog(primaryStage);

 

                        if (file != null){

 

                            openFile(file);

 

                        }

 

                    }

 

                });

 

 

        final GridPane inputGridPane = new GridPane();

 

       

 

        GridPane.setConstraints(uploadButton, 100, 50);

 

        inputGridPane.setHgap(6);

 

        inputGridPane.setVgap(6);

 

        inputGridPane.getChildren().addAll(uploadButton);

 

       

 

        final Pane rootGroup = new VBox(12);

 

        rootGroup.getChildren().addAll(inputGridPane);

 

        rootGroup.setPadding(new Insets(12, 12, 12, 12));

 

       

 

        primaryStage.setScene(new Scene(rootGroup));

 

        primaryStage.show();

 

       

 

    }

 

 

    /**

 

     * @param args the command line arguments

 

     */

 

   

 

    public static void main(String[] args) {

 

        Application.launch(args);

 

    }

 

   

 

    private static void configureFileChooser(final FileChooser fileChooser){

 

        fileChooser.setTitle("Choose a File");

 

        fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));

 

       

 

        fileChooser.getExtensionFilters().addAll(

 

            new FileChooser.ExtensionFilter("All Files", "*.*"),

 

            new FileChooser.ExtensionFilter("DOC", ".doc"),

 

            new FileChooser.ExtensionFilter("DOCX", ".docx")

 

        );                      

 

    }

 

   

 

    private void openFile(File file){

 

        try{

 

            desktop.open(file);

 

        }

 

        catch (IOException ex){

 

            Logger.getLogger(BusinessSalesDataAnalysis.class.getName()).log(Level.SEVERE, null, ex);

 

        }

 

    }

 

   

 

}

 

Comments

458726
You choose the desired location on the first time, and the next time the SQL Developer will suggest the location that you chose earlier.
chrisis
From the help file

To specify a nondefault SQLDEVELOPER_USER_DIR location, do either of the following:

Set the SQLDEVELOPER_USER_DIR environment variable to specify another directory path.

Edit the <sqldeveloper_install>\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf file and substitute the desired directory path for SQLDEVELOPER_USER_DIR in the following line:
SetUserHomeVariable SQLDEVELOPER_USER_DIR


HTH

Chris
Stuart Fleming
A bit Late, but thank you!
DavidZ
Is there an equivalent option for SQL Developer 3.1? I would like to have both 3.1 and 3.0 installed on my machine, and run either. I share reports with others in the company, and those will need to stay at 3.0.

I tried including the following in sqldeveloper.conf
SetUserHomeVariable C:\Users\[myuserid]\AppData\Roaming\SQLDeveloper31
This resulted in a warning:
WARNING: Unknown directive: SetUserHomeVariable
(Replacing back slashes with forward slashes made no difference)

Windows 7
SQL Developer 3.1 with bundled JDK.
Gary Graham-Oracle
Hi David,

According to documentation, the IDE_USER_DIR is picked up automatically if set, so there should be no need for an additional conf file set statement in any recent SQL Developer release. There is another way, however:

A similar case occurs when one wishes to run SQL Developer from a flash-drive and also keep user-related information on that drive, e.g.,

1. Unzip SQL Developer into E:\sqldeveloper
2. Add the following line to one of your conf files: ide\bin\jdk.conf, ide\bin\ide.conf, or sqldeveloper\bin\sqldeveloper.conf
AddVMOption -Dide.user.dir=../../.sqldeveloper

The path given is relative to a starting directory of E:\sqldeveloper\sqldeveloper\bin, 
so the directory containing user-related data will be E:\sqldeveloper\.sqldeveloper 
3. Note that the "include" sequence for these conf files is jdk.conf -> ide.conf -> sqldeveloper.conf

If you look in Help|About|Properties, you can scroll to find the ide.user.dir property and other related properties. The Help also documents which files or types of files will be stored there. See SQL Developer Concepts and Usages|SQL Developer Preferences, then Location of User-Related Information.

Regards,
Gary
SQL Developer Team
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 24 2015
Added on May 25 2015
29 comments
3,707 views