Hej, witajcie! krotko bawie sie w programowanie, wiec czesto napotykam problemy. Mam nadzieje, ze pomozecie mi w tym;)
Fragment kodu ponizej:
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.Scanner;
class Swir_vnir
{
int option;
int length;
String wave_source;
String pigments_source;
String pigments_number;
String final_source;
Swir_vnir()
{
this.option = 0;
this.length = 0;
this.wave_source = "";
this.pigments_source = "";
this.pigments_number = "";
this.final_source = "";
}
.
.
.
.
void get_pigments_source()
{
String result;
Scanner reader = new Scanner(System.in);
System.out.println("Type path to the data about the pigment you are intrested about");
result = reader.nextLine();
this.pigments_source = result;
}
.
.
.
.
String [][] read_data() throws FileNotFoundException
{
String [][] means_deviations = new String [2][length];
File pigments_means = new File(pigments_source);
File waves = new File(wave_source);
try
{
Scanner reader1 = new Scanner(waves);
Scanner reader2 = new Scanner(pigments_means);
.
.
.
.
catch(FileNotFoundException ex)
{
System.out.println("File cannot be opend");
}
return means_deviations;
}
Mianowicie chodzi o to, ze read_data() wyrzuca mi wyjatek dla pigments_source. Czy wiecie, jak wiec powinien wygladac zapis sciezki do pliku tak, aby program dzialal? Probowalam juz przeroznych rozwiazan, lacznie z zamiana wszystkich "" wprowadzanych z klawiatury na "\" lub "/'. Moze nie w tym problem?
Bylabym wdzieczna za wszelka pomoc;)