mirror of
https://github.com/Akomry/sae302_applicom.git
synced 2025-12-06 11:43:53 +00:00
fix(resources): tweaks sur les resources du projet, fonctionne désormais sur la version compilée de l'app
This commit is contained in:
parent
d11df74578
commit
d4e6f47c52
8 changed files with 20 additions and 3 deletions
|
|
@ -64,6 +64,12 @@
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.48.0.0</version>
|
<version>3.48.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>2.0.16</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ module rtgre.chat {
|
||||||
requires net.synedra.validatorfx;
|
requires net.synedra.validatorfx;
|
||||||
requires org.json;
|
requires org.json;
|
||||||
requires java.sql;
|
requires java.sql;
|
||||||
|
requires org.xerial.sqlitejdbc;
|
||||||
|
|
||||||
|
|
||||||
opens rtgre.chat to javafx.fxml;
|
opens rtgre.chat to javafx.fxml;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ public class ChatLauncher {
|
||||||
ChatApplication.main(args);
|
ChatApplication.main(args);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
System.out.println("test2");
|
System.out.println("test2");
|
||||||
ChatApplication.main(args);
|
ChatApplication.main(args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public class ChatApplication extends Application {
|
||||||
InputStream is = ChatApplication.class
|
InputStream is = ChatApplication.class
|
||||||
.getResource("logging.properties").openStream();
|
.getResource("logging.properties").openStream();
|
||||||
LogManager.getLogManager().readConfiguration(is);
|
LogManager.getLogManager().readConfiguration(is);
|
||||||
if (!Files.exists(new File("chat/target/").toPath())) {
|
if (!Files.exists(new File("target/").toPath())) {
|
||||||
Files.createDirectory(new File("target").toPath());
|
Files.createDirectory(new File("target").toPath());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ public class ChatController implements Initializable {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream in = ChatController.class.getResourceAsStream("config.properties");
|
InputStream in = ChatController.class.getResourceAsStream("config.properties");
|
||||||
|
System.out.println(ChatController.class.getResource("config.properties").getPath());
|
||||||
properties.load(in);
|
properties.load(in);
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
this.contact.setAvatar(Contact.base64ToImage(properties.getProperty("avatar")));
|
this.contact.setAvatar(Contact.base64ToImage(properties.getProperty("avatar")));
|
||||||
|
|
@ -241,6 +242,7 @@ public class ChatController implements Initializable {
|
||||||
}
|
}
|
||||||
properties.setProperty("avatar", Contact.imageToBase64(ImageIO.read(selectedFile)));
|
properties.setProperty("avatar", Contact.imageToBase64(ImageIO.read(selectedFile)));
|
||||||
properties.store(new FileOutputStream(getClass().getResource("config.properties").getPath()), null);
|
properties.store(new FileOutputStream(getClass().getResource("config.properties").getPath()), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.warning("Impossible de lire l'image!");
|
LOGGER.warning("Impossible de lire l'image!");
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import javax.xml.transform.Result;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.sqlite.JDBC;
|
||||||
|
|
||||||
import static rtgre.chat.ChatApplication.LOGGER;
|
import static rtgre.chat.ChatApplication.LOGGER;
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@ public class DatabaseApi {
|
||||||
|
|
||||||
public DatabaseApi() {
|
public DatabaseApi() {
|
||||||
try {
|
try {
|
||||||
this.con = DriverManager.getConnection("jdbc:sqlite:chat/src/main/resources/rtgre/chat/dbase.db");
|
this.con = DriverManager.getConnection("jdbc:sqlite:target/dbase.db");
|
||||||
this.stmt = con.createStatement();
|
this.stmt = con.createStatement();
|
||||||
initDB(con);
|
initDB(con);
|
||||||
LOGGER.info("Database connected!");
|
LOGGER.info("Database connected!");
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,11 @@ public class ChatServer {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
try {
|
||||||
|
Class.forName("org.sqlite.JDBC");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
ChatServer server = new ChatServer(2024);
|
ChatServer server = new ChatServer(2024);
|
||||||
//daisyConnect();
|
//daisyConnect();
|
||||||
server.acceptClients();
|
server.acceptClients();
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler
|
||||||
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
|
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
|
||||||
|
|
||||||
# Nom du fichier de logs
|
# Nom du fichier de logs
|
||||||
java.util.logging.FileHandler.pattern=chat/target/java%u.log
|
java.util.logging.FileHandler.pattern=target/java%u.log
|
||||||
|
|
||||||
# Format de logs plus compact sur 1 seule ligne
|
# Format de logs plus compact sur 1 seule ligne
|
||||||
java.util.logging.SimpleFormatter.format=%1$tF %1$tT.%1$tL | %4$-7s | %2$s | %5$s %6$s%n
|
java.util.logging.SimpleFormatter.format=%1$tF %1$tT.%1$tL | %4$-7s | %2$s | %5$s %6$s%n
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue